Added data attribute to glossary terms
authorThierry Florac <tflorac@ulthar.net>
Fri, 04 Jan 2019 09:40:23 +0100
changeset 337 8ff15f47b281
parent 336 5e39ba665e50
child 338 7ab6cc0e1695
Added data attribute to glossary terms
src/pyams_default_theme/resources/js/pyams-default.js
src/pyams_default_theme/resources/js/pyams-default.min.js
--- a/src/pyams_default_theme/resources/js/pyams-default.js	Fri Jan 04 09:40:01 2019 +0100
+++ b/src/pyams_default_theme/resources/js/pyams-default.js	Fri Jan 04 09:40:23 2019 +0100
@@ -153,7 +153,8 @@
 		if (modal.exists()) {
 			ams.dialog.close(modal);
 		}
-		ams.dialog.open('/get-glossary-term.html?term=' + $(this).text(), {}, {
+		var term = $(this).data('term') || $(this).text();
+		ams.dialog.open('/get-glossary-term.html?term=' + term, {}, {
 			shown: function() {
 				$('.thesaurus-term').off('click').on('click', clickTerm);
 			}
--- a/src/pyams_default_theme/resources/js/pyams-default.min.js	Fri Jan 04 09:40:01 2019 +0100
+++ b/src/pyams_default_theme/resources/js/pyams-default.min.js	Fri Jan 04 09:40:23 2019 +0100
@@ -1,1 +1,1 @@
-!function(a,t){"use strict";var e=t.MyAMS;t.PyAMS_default={search:{updateSort:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=a(this).val();a('input[name="order_by"]',t).val(e),t.submit()}},updatePageLength:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=a(this).val();a('input[name="start"]',t).val(0),a('input[name="length"]',t).val(e),t.submit()}},previousPage:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=a(this).parents("ol.pagination").data("ams-current-page"),n=a('input[name="length"]',t).val();a('input[name="start"]',t).val(n*(e-2)),t.submit()}},nextPage:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=a(this).parents("ol.pagination").data("ams-current-page"),n=a('input[name="length"]',t).val();a('input[name="start"]',t).val(n*e),t.submit()}},gotoPage:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=parseInt(a(this).text()),n=a('input[name="length"]',t).val();a('input[name="start"]',t).val(n*(e-1)),t.submit()}}}},a(document).on("click",'[data-toggle="lightbox"]',function(t){t.preventDefault();var n=a(this);e.ajax.check(a.fn.ekkoLightbox,"/--static--/pyams_default_theme/js/ext/ekko-lightbox"+e.devext+".js",function(){n.ekkoLightbox({wrapping:!1,alwaysShowClose:!0,onContentLoaded:function(){var t=this.element().data("description"),e=this.modal(),n=a(".ekko-lightbox-container",e);a(".description",n).remove(),t&&a("<div></div>").addClass("description").text(t).appendTo(n)}})})}),a(document).on("click","[data-ams-click-handler]",function(t){var n=a(this),i=n.data("ams-disabled-handlers");if(!0!==i&&"click"!==i&&"all"!==i){var s=n.data();if(s.amsClickHandler){!0!==s.amsStopPropagation&&!0!==s.amsClickStopPropagation||t.stopPropagation(),!0!==s.amsClickKeepDefault&&t.preventDefault();for(var r=s.amsClickHandler.split(/\s+/),o=0;o<r.length;o++){var l=e.getFunctionByName(r[o]);void 0!==l&&l.call(n,t,s.amsClickHandlerOptions)}}}}),a(document).on("change","[data-ams-change-handler]",function(t){var n=a(this);if(!n.prop("readonly")){var i=n.data("ams-disabled-handlers");if(!0!==i&&"change"!==i&&"all"!==i){var s=n.data();if(s.amsChangeHandler){!0!==s.amsStopPropagation&&!0!==s.amsChangeStopPropagation||t.stopPropagation(),!0!==s.amsChangeKeepDefault&&t.preventDefault();for(var r=s.amsChangeHandler.split(/\s+/),o=0;o<r.length;o++){var l=e.getFunctionByName(r[o]);void 0!==l&&l.call(n,t,s.amsChangeHandlerOptions)}}}}});var n=function(){var t=a(".modal >div");t.exists()&&e.dialog.close(t),e.dialog.open("/get-glossary-term.html?term="+a(this).text(),{},{shown:function(){a(".thesaurus-term").off("click").on("click",n)}})};e.require(["error","ajax","dialog"],function(){a(".thesaurus-term").off("click").on("click",n)})}(jQuery,this);
+!function(a,t){"use strict";var e=t.MyAMS;t.PyAMS_default={search:{updateSort:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=a(this).val();a('input[name="order_by"]',t).val(e),t.submit()}},updatePageLength:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=a(this).val();a('input[name="start"]',t).val(0),a('input[name="length"]',t).val(e),t.submit()}},previousPage:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=a(this).parents("ol.pagination").data("ams-current-page"),n=a('input[name="length"]',t).val();a('input[name="start"]',t).val(n*(e-2)),t.submit()}},nextPage:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=a(this).parents("ol.pagination").data("ams-current-page"),n=a('input[name="length"]',t).val();a('input[name="start"]',t).val(n*e),t.submit()}},gotoPage:function(){var t=a('form[id="search-results"]');if(t.exists()){var e=parseInt(a(this).text()),n=a('input[name="length"]',t).val();a('input[name="start"]',t).val(n*(e-1)),t.submit()}}}},a(document).on("click",'[data-toggle="lightbox"]',function(t){t.preventDefault();var n=a(this);e.ajax.check(a.fn.ekkoLightbox,"/--static--/pyams_default_theme/js/ext/ekko-lightbox"+e.devext+".js",function(){n.ekkoLightbox({wrapping:!1,alwaysShowClose:!0,onContentLoaded:function(){var t=this.element().data("description"),e=this.modal(),n=a(".ekko-lightbox-container",e);a(".description",n).remove(),t&&a("<div></div>").addClass("description").text(t).appendTo(n)}})})}),a(document).on("click","[data-ams-click-handler]",function(t){var n=a(this),i=n.data("ams-disabled-handlers");if(!0!==i&&"click"!==i&&"all"!==i){var s=n.data();if(s.amsClickHandler){!0!==s.amsStopPropagation&&!0!==s.amsClickStopPropagation||t.stopPropagation(),!0!==s.amsClickKeepDefault&&t.preventDefault();for(var r=s.amsClickHandler.split(/\s+/),o=0;o<r.length;o++){var l=e.getFunctionByName(r[o]);void 0!==l&&l.call(n,t,s.amsClickHandlerOptions)}}}}),a(document).on("change","[data-ams-change-handler]",function(t){var n=a(this);if(!n.prop("readonly")){var i=n.data("ams-disabled-handlers");if(!0!==i&&"change"!==i&&"all"!==i){var s=n.data();if(s.amsChangeHandler){!0!==s.amsStopPropagation&&!0!==s.amsChangeStopPropagation||t.stopPropagation(),!0!==s.amsChangeKeepDefault&&t.preventDefault();for(var r=s.amsChangeHandler.split(/\s+/),o=0;o<r.length;o++){var l=e.getFunctionByName(r[o]);void 0!==l&&l.call(n,t,s.amsChangeHandlerOptions)}}}}});var n=function(){var t=a(".modal >div");t.exists()&&e.dialog.close(t);var i=a(this).data("term")||a(this).text();e.dialog.open("/get-glossary-term.html?term="+i,{},{shown:function(){a(".thesaurus-term").off("click").on("click",n)}})};e.require(["error","ajax","dialog"],function(){a(".thesaurus-term").off("click").on("click",n)})}(jQuery,this);