Merge branch 'gh-pages' into develop
* gh-pages: limit card size to one print page Conflicts: bookmarklet.js
This commit is contained in:
commit
647b9d6420
100
bookmarklet.js
100
bookmarklet.js
@ -23,9 +23,7 @@
|
|||||||
ga('set', 'page', '/cardprinter');
|
ga('set', 'page', '/cardprinter');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// load jQuery
|
// load jQuery
|
||||||
if (window.jQuery === undefined) {
|
if (window.jQuery === undefined) {
|
||||||
appendScript('//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js');
|
appendScript('//ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js');
|
||||||
@ -36,6 +34,15 @@
|
|||||||
init();
|
init();
|
||||||
main();
|
main();
|
||||||
});
|
});
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err.message);
|
||||||
|
if(!isDev){
|
||||||
|
ga('send', 'exception', {
|
||||||
|
'exDescription': err.message,
|
||||||
|
'exFatal': true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function init(){
|
function init(){
|
||||||
addJQueryFunctions();
|
addJQueryFunctions();
|
||||||
@ -83,11 +90,26 @@
|
|||||||
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
||||||
var printWindow = printFrame[0].contentWindow;
|
var printWindow = printFrame[0].contentWindow;
|
||||||
var printDocument = printWindow.document;
|
var printDocument = printWindow.document;
|
||||||
if(!isDev){
|
|
||||||
if(!isDev){
|
if(!isDev){
|
||||||
ga('send', 'event', 'button', 'click', 'print', jQuery(".card", printDocument).length );
|
ga('send', 'event', 'button', 'click', 'print', jQuery(".card", printDocument).length );
|
||||||
}
|
}
|
||||||
}
|
printWindow.matchMedia("print").addListener(function() {
|
||||||
|
jQuery(".page",printDocument).each(function(position, page) {
|
||||||
|
var height = jQuery(page).height()
|
||||||
|
- jQuery(page).find(".card-header").outerHeight()
|
||||||
|
- jQuery(page).find(".card-footer").outerHeight()
|
||||||
|
- jQuery(page).find(".content-header").outerHeight()
|
||||||
|
- 40;
|
||||||
|
jQuery(page).find(".description").css("max-height", height+"px");
|
||||||
|
var lineHeight = jQuery(page).find(".description").css("line-height");
|
||||||
|
lineHeight = lineHeight.substring(0, lineHeight.length - 2);
|
||||||
|
var lineClamp = Math.floor(height / lineHeight);
|
||||||
|
jQuery(page).find(".description").css("-webkit-line-clamp", lineClamp+"");
|
||||||
|
|
||||||
|
jQuery(page).width("40%");
|
||||||
|
jQuery(page).scc("float","left");
|
||||||
|
});
|
||||||
|
});
|
||||||
printWindow.print();
|
printWindow.print();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,14 +126,14 @@
|
|||||||
resizeIframe(printFrame);
|
resizeIframe(printFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableMultiCardPage(enable){
|
function endableMultiCardPage(enable){
|
||||||
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
var printFrame = jQuery("#card-print-dialog-content-iframe");
|
||||||
var printWindow = printFrame[0].contentWindow;
|
var printWindow = printFrame[0].contentWindow;
|
||||||
var printDocument = printWindow.document;
|
var printDocument = printWindow.document;
|
||||||
if(enable){
|
if(enable){
|
||||||
jQuery(".page", printDocument).addClass("avoid-page-break");
|
jQuery(".page", printDocument).addClass("multiCardPage");
|
||||||
} else {
|
} else {
|
||||||
jQuery(".page", printDocument).removeClass("avoid-page-break");
|
jQuery(".page", printDocument).removeClass("multiCardPage");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,7 +393,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="card-print-dialog-footer">
|
<div id="card-print-dialog-footer">
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<label style="margin-right:10px"><input id="card-scale-range" type="range" min="0.4" max="1.4" step="0.05" value="1.0" />Scale</label>
|
<label style="margin-right:10px"><input id="card-scale-range" type="range" min="0.2" max="1.6" step="0.1" value="1.0" />Scale</label>
|
||||||
<label style="margin-right:10px"><input id="hide-description-checkbox" type="checkbox"/>Hide Description</label>
|
<label style="margin-right:10px"><input id="hide-description-checkbox" type="checkbox"/>Hide Description</label>
|
||||||
<label style="margin-right:10px"><input id="multi-card-page-checkbox" type="checkbox"/>Multi Card Page</label>
|
<label style="margin-right:10px"><input id="multi-card-page-checkbox" type="checkbox"/>Multi Card Page</label>
|
||||||
<input id="card-print-dialog-print" type="button" class="aui-button aui-button-primary" value="Print" />
|
<input id="card-print-dialog-print" type="button" class="aui-button aui-button-primary" value="Print" />
|
||||||
@ -399,7 +421,7 @@
|
|||||||
|
|
||||||
result.find("#multi-card-page-checkbox")
|
result.find("#multi-card-page-checkbox")
|
||||||
.click(function() {
|
.click(function() {
|
||||||
enableMultiCardPage(this.checked);
|
endableMultiCardPage(this.checked);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -569,7 +591,7 @@
|
|||||||
*/
|
*/
|
||||||
}));
|
}));
|
||||||
return result;
|
return result;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
|
||||||
function printPanelPageCSS(){
|
function printPanelPageCSS(){
|
||||||
@ -581,22 +603,19 @@
|
|||||||
/*!
|
/*!
|
||||||
HTML {
|
HTML {
|
||||||
font-size: 1.0cm;
|
font-size: 1.0cm;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
|
||||||
padding: 0.5cm;
|
|
||||||
}
|
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
padding: 0.5cm;
|
padding: 1.0cm;
|
||||||
margin-top: 0.5cm;
|
margin: 1.0cm;
|
||||||
margin-bottom: 0.5cm;
|
|
||||||
width: auto;
|
width: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
page-break-after: always;
|
||||||
|
page-break-inside: avoid;
|
||||||
|
|
||||||
background:white;
|
background:white;
|
||||||
|
|
||||||
@ -614,23 +633,13 @@
|
|||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
|
|
||||||
body {
|
|
||||||
padding: 0.0cm;
|
|
||||||
margin: 0.0cm;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.page {
|
.page {
|
||||||
background: white;
|
max-height:100% ;
|
||||||
padding: 0.0cm;
|
height: 100%;
|
||||||
margin: 0.0cm;
|
|
||||||
margin-bottom: 1.0cm;
|
|
||||||
|
|
||||||
page-break-after: always;
|
|
||||||
page-break-inside: avoid;
|
|
||||||
|
|
||||||
background: white;
|
background: white;
|
||||||
border-style: none;
|
border-style: none;
|
||||||
|
padding: 0.0cm;
|
||||||
|
margin: 0.0cm;
|
||||||
|
|
||||||
-webkit-box-shadow: none;
|
-webkit-box-shadow: none;
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
@ -639,9 +648,16 @@
|
|||||||
print-color-adjust: exact;
|
print-color-adjust: exact;
|
||||||
}
|
}
|
||||||
|
|
||||||
.avoid-page-break {
|
.multiCardPage {
|
||||||
|
height: auto;
|
||||||
|
margin-bottom: 1.0cm;
|
||||||
page-break-after: avoid;
|
page-break-after: avoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.page:last-of-type {
|
||||||
|
page-break-after: avoid;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}));
|
}));
|
||||||
@ -737,10 +753,11 @@
|
|||||||
height: 3.2rem;
|
height: 3.2rem;
|
||||||
background: #d0d0d0;
|
background: #d0d0d0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-width: 17.0rem;
|
min-width: 17.0rem;
|
||||||
|
max-height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.author{
|
.author{
|
||||||
line-height: 0.8rem;
|
line-height: 0.8rem;
|
||||||
@ -791,7 +808,7 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
line-height: 1.1rem;
|
line-height: 1.1rem;
|
||||||
margin-bottom: 0.6rem;
|
//margin-bottom: 0.6rem;
|
||||||
}
|
}
|
||||||
.card-footer {
|
.card-footer {
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -800,8 +817,12 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
.description {
|
.description {
|
||||||
|
display: block;
|
||||||
font-size: 0.6rem;
|
font-size: 0.6rem;
|
||||||
line-height: 0.6rem;
|
line-height: 0.6rem;
|
||||||
|
overflow: hidden;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
}
|
}
|
||||||
.key {
|
.key {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -1178,13 +1199,4 @@
|
|||||||
iframe.height(iframe[0].contentWindow.document.body.scrollHeight);
|
iframe.height(iframe[0].contentWindow.document.body.scrollHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (err) {
|
|
||||||
console.logError(err.message);
|
|
||||||
if(!isDev){
|
|
||||||
ga('send', 'exception', {
|
|
||||||
'exDescription': err.message,
|
|
||||||
'exFatal': true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})();
|
})();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user