4,554
edits
No edit summary |
No edit summary |
||
Line 1,281: | Line 1,281: | ||
var $chooser = jQuery("#print-chooser"); | var $chooser = jQuery("#print-chooser"); | ||
if ($chooser.length) return $chooser; | if ($chooser.length) return $chooser; | ||
$chooser = jQuery( | $chooser = jQuery( | ||
'<div id="print-chooser" class="print-chooser" style="display:none;">' + | '<div id="print-chooser" class="print-chooser" style="display:none;">' + | ||
Line 1,288: | Line 1,289: | ||
); | ); | ||
jQuery("#print-button").after($chooser); | jQuery("#print-button").after($chooser); | ||
// Bind the choice clicks ONCE, scoped to this chooser | |||
if (!$chooser.data("swBound")) { | |||
$chooser.on("click", "a#sw-print-with, a#sw-print-no", function (e) { | |||
e.preventDefault(); | |||
var id = | |||
this.id === "sw-print-no" ? "print-no-border" : "print-with-border"; | |||
try { | |||
console.log("[swprint] chooser click ->", this.id, "=>", id); | |||
} catch (e2) {} | |||
swHandlePrintChoice(id, jQuery(this)); | |||
}); | |||
$chooser.data("swBound", true); | |||
} | |||
return $chooser; | return $chooser; | ||
} | } | ||
Line 1,824: | Line 1,840: | ||
e.preventDefault(); | e.preventDefault(); | ||
swHandlePrintChoice($choice.attr("id"), $choice); | swHandlePrintChoice($choice.attr("id"), $choice); | ||
} | } | ||
); | ); |