doortts doortts 2017-04-18
js: Fix Yona's jQuery template related bug
@5cd75c4bdd95dbdff660c4c2e58e54e7ca7ab976
public/javascripts/common/yobi.ui.Dialog.js
--- public/javascripts/common/yobi.ui.Dialog.js
+++ public/javascripts/common/yobi.ui.Dialog.js
@@ -101,7 +101,7 @@
             var aButtonStyles = htOptions.aButtonStyles || [];
 
             for(var i = 0, nLength = aButtonLabels.length; i < nLength; i++){
-                aButtonsHTML.push($.tmpl(htVar.sTplCustomButton, {
+                aButtonsHTML.push($yobi.tmpl(htVar.sTplCustomButton, {
                     "text" : aButtonLabels[i],
                     "class": aButtonStyles[i] || (aButtonStyles.length === 0 && i === nLength-1 ? "ybtn-primary" : "ybtn-default")
                 }));
public/javascripts/yona-common.js
--- public/javascripts/yona-common.js
+++ public/javascripts/yona-common.js
This diff is too big to display.
public/javascripts/yona-lib.js
--- public/javascripts/yona-lib.js
+++ public/javascripts/yona-lib.js
@@ -35,7 +35,7 @@
 32:"SPACE",8:"BACKSPACE",9:"TAB",46:"DELETE",33:"PAGEUP",34:"PAGEDOWN",36:"HOME",35:"END",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",219:"[",221:"]",186:";",222:"'",188:",",190:".",191:"/",189:"-",187:"=",220:"\\",192:"`",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",
 120:"F9",121:"F10",122:"F11",123:"F12"};$(window).on({keydown:q,beforeunload:l});return{attach:r,detach:u,getHandlers:function(){return e},setKeymapLink:function(c){var b,a=function(a){a.bFormInput||(document.location.href=c[a.sKeyInput])};for(b in c)c[b]?r(b,a):u(b)}}}();(function(h){h=$yobi.createNamespace(h);h.container[h.name]=function(h,r){function u(b){if("function"===typeof e.fOnClickButton&&!1===e.fOnClickButton({weEvt:b,nButtonIndex:$(this).index()}))return!1;k()}function k(){c.welContainer.modal("hide")}function l(){"function"==typeof e.fOnAfterShow&&e.fOnAfterShow();e.bAutoFocusOnLastButton&&c.welButtons.find(".ybtn-primary:last,button:last").focus()}function f(){c.welMessage.html("");"function"==typeof e.fOnAfterHide&&e.fOnAfterHide()}var e={},c={};(function(b,
 a){e.sDefaultButton='<button type="button" class="ybtn ybtn-info" data-dismiss="modal">'+Messages("button.confirm")+"</button>";e.sTplCustomButton='<button type="button" class="ybtn ${class}">${text}</button>';e.bAutoFocusOnLastButton="undefined"!==typeof a.bAutoFocusOnLastButton?a.bAutoFocusOnLastButton:!0;c.welContainer=$(b).clone();c.welMessage=c.welContainer.find(".msg");c.welDescription=c.welContainer.find(".desc");c.welButtons=c.welContainer.find(".buttons");c.welContainer.modal({show:!1});
-c.welContainer.on("shown",l);c.welContainer.on("hidden",f);c.welContainer.on("click","button.ybtn",u)})(h,r||{});return{show:function(b,a,d){e.fOnAfterShow=d.fOnAfterShow;e.fOnAfterHide=d.fOnAfterHide;e.fOnClickButton=d.fOnClickButton;var f;if(d.aButtonLabels){f=[];var k=d.aButtonLabels;d=d.aButtonStyles||[];for(var h=0,l=k.length;h<l;h++)f.push($.tmpl(e.sTplCustomButton,{text:k[h],"class":d[h]||(0===d.length&&h===l-1?"ybtn-primary":"ybtn-default")}));f=f.join("")}else f=e.sDefaultButton;c.welButtons.html(f);
+c.welContainer.on("shown",l);c.welContainer.on("hidden",f);c.welContainer.on("click","button.ybtn",u)})(h,r||{});return{show:function(b,a,d){e.fOnAfterShow=d.fOnAfterShow;e.fOnAfterHide=d.fOnAfterHide;e.fOnClickButton=d.fOnClickButton;var f;if(d.aButtonLabels){f=[];var k=d.aButtonLabels;d=d.aButtonStyles||[];for(var h=0,l=k.length;h<l;h++)f.push($yobi.tmpl(e.sTplCustomButton,{text:k[h],"class":d[h]||(0===d.length&&h===l-1?"ybtn-primary":"ybtn-default")}));f=f.join("")}else f=e.sDefaultButton;c.welButtons.html(f);
 c.welMessage.html($yobi.nl2br(b));c.welDescription.html($yobi.nl2br(a||""));c.welContainer.modal("show")},hide:k}}})("yobi.ui.Dialog");(function(h){h=$yobi.createNamespace(h);h.container[h.name]=function(h){function r(b){if(0<b.originalEvent.deltaY&&a.welList.scrollTop()+a.welList.height()===a.welList.get(0).scrollHeight||0>b.originalEvent.deltaY&&0===a.welList.scrollTop())return b.preventDefault(),b.stopPropagation(),!1}function u(a){var b=$(a.target),b="LI"===a.target.tagName?b:$(b.parents("li")[0]);if(0===b.length||"undefined"===typeof b.attr("data-value"))return a.stopPropagation(),a.preventDefault(),!1;k(b);l(b);f()}function k(b){a.welSelectedLabel.html(b.html());
 a.waItems.removeClass("active");b.addClass("active")}function l(c){c=c.attr("data-value");var e=a.welContainer.attr("data-name");b.sName=e;b.sValue=c;if("undefined"!==typeof e){var f=a.welContainer.find("input[name='"+e+"']");0===f.length&&(f=$('<input type="hidden" name="'+e+'">'),a.welContainer.append(f));f.val(c)}}function f(){"function"==typeof b.fOnChange&&setTimeout(function(){b.fOnChange(e())},0)}function e(){return b.sValue}function c(b){b=a.welContainer.find(b);if(0>=b.length)return!1;b=
 $(b[0]);k(b);l(b);return!0}var b={sValue:""},a={};(function(d){a.welContainer=$(d.elContainer);a.welSelectedLabel=a.welContainer.find(".d-label");a.welList=a.welContainer.find(".dropdown-menu");a.waItems=a.welList.find("li");a.welList.on("click","li",u);a.welList.on("mousewheel",r);b.fOnChange=d.fOnChange;c("li[data-selected=true]")})(h);return{getValue:e,onChange:function(a){b.fOnChange=a;return!0},selectByValue:function(a){return c("li[data-value='"+a+"']")},selectItem:c}}})("yobi.ui.Dropdown");$(document).ready(function(){function h(k,h){var f;h=$("#"+k).find("li > a");(f=localStorage.getItem("yobitab-"+k))&&h[f]&&(f=$(h[f]))&&f.data(!1)&&f.tab("show")}var q,r,u;$(".nav-tabs[id]").each(function(k,l){r=$(l);u=r.attr("id");"undefined"!=typeof u&&(q=r.find("li"),q.click(function(){localStorage.setItem("yobitab-"+u,$(this).index())}),h(u,q))})});(function(h){h=$yobi.createNamespace(h);h.container[h.name]=function(h,r){function u(c){$(this).remove()}function k(c,b){c.bind("webkitTransitionEnd",function(){c.remove()});setTimeout(function(){c.css("opacity",0)},b)}var l,f,e;(function(c,b){b.sTplToast=b.sTplToast.replace("\n","");l=b.sTplToast||'<div class="toast" tabindex="-1">            <div class="btn-dismiss"><button type="button" class="btn-transparent">&times;</button></div>            <div class="center-text msg"></div></div>';f=$(c);
Add a comment
List