From 8a11911021a2b41f4e41f8962906d25fe6dc3d17 Mon Sep 17 00:00:00 2001 From: Mathias Helin Date: Thu, 31 Aug 2017 17:26:37 +0200 Subject: [PATCH] Reset jquery.tree to the previous version --- .../Js/jstree/plugins/jquery.tree.cookie.js | 135 +++++++++--------- .../jstree/plugins/jquery.tree.themeroller.js | 62 ++++---- 2 files changed, 99 insertions(+), 98 deletions(-) diff --git a/src/Backend/Modules/Pages/Js/jstree/plugins/jquery.tree.cookie.js b/src/Backend/Modules/Pages/Js/jstree/plugins/jquery.tree.cookie.js index 95e2bee7df..8036510641 100644 --- a/src/Backend/Modules/Pages/Js/jstree/plugins/jquery.tree.cookie.js +++ b/src/Backend/Modules/Pages/Js/jstree/plugins/jquery.tree.cookie.js @@ -1,69 +1,70 @@ (function ($) { - if (typeof $.cookie === 'undefined') throw 'jsTree cookie: jQuery cookie plugin not included.' + if(typeof $.cookie == "undefined") throw "jsTree cookie: jQuery cookie plugin not included."; - $.extend($.tree.plugins, { - 'cookie': { - defaults: { - prefix: '', // a prefix that will be used for all cookies for this tree - options: { - expires: false, - path: false, - domain: false, - secure: false - }, - types: { - selected: true, // should we set the selected cookie - open: true // should we set the open cookie - }, - keep_selected: false, // should we merge with the selected option or overwrite it - keep_opened: false // should we merge with the opened option or overwrite it - }, - set_cookie: function (type) { - var opts = $.extend(true, {}, $.tree.plugins.cookie.defaults, this.settings.plugins.cookie) - if (opts.types[type] !== true) return false - switch (type) { - case 'selected': - if (this.settings.rules.multiple != false && this.selected_arr.length > 1) { - var val = Array() - $.each(this.selected_arr, function () { - if (this.attr('id')) { val.push(this.attr('id')) } - }) - val = val.join(',') - } else var val = this.selected ? this.selected.attr('id') : false - $.cookie(opts.prefix + 'selected', val, opts.options) - break - case 'open': - var str = '' - this.container.find('li.open').each(function (i) { if (this.id) { str += this.id + ',' } }) - $.cookie(opts.prefix + 'open', str.replace(/,$/ig, ''), opts.options) - break - } - }, - callbacks: { - oninit: function (t) { - var opts = $.extend(true, {}, $.tree.plugins.cookie.defaults, this.settings.plugins.cookie) - var tmp = false - tmp = $.cookie(opts.prefix + 'open') - if (tmp) { - tmp = tmp.split(',') - if (opts.keep_opened) this.settings.opened = $.unique($.merge(tmp, this.settings.opened)) - else this.settings.opened = tmp - } - tmp = $.cookie(opts.prefix + 'selected') - if (tmp) { - tmp = tmp.split(',') - if (opts.keep_selected) this.settings.selected = $.unique($.merge(tmp, this.settings.opened)) - else this.settings.selected = tmp - } - }, - onchange: function () { $.tree.plugins.cookie.set_cookie.apply(this, ['selected']) }, - onopen: function () { $.tree.plugins.cookie.set_cookie.apply(this, ['open']) }, - onclose: function () { $.tree.plugins.cookie.set_cookie.apply(this, ['open']) }, - ondelete: function () { $.tree.plugins.cookie.set_cookie.apply(this, ['open']) }, - oncopy: function () { $.tree.plugins.cookie.set_cookie.apply(this, ['open']) }, - oncreate: function () { $.tree.plugins.cookie.set_cookie.apply(this, ['open']) }, - onmoved: function () { $.tree.plugins.cookie.set_cookie.apply(this, ['open']) } - } - } - }) -})(jQuery) + $.extend($.tree.plugins, { + "cookie" : { + defaults : { + prefix : "", // a prefix that will be used for all cookies for this tree + options : { + expires: false, + path: false, + domain: false, + secure: false + }, + types : { + selected : true, // should we set the selected cookie + open : true // should we set the open cookie + }, + keep_selected : false, // should we merge with the selected option or overwrite it + keep_opened : false // should we merge with the opened option or overwrite it + }, + set_cookie : function (type) { + var opts = $.extend(true, {}, $.tree.plugins.cookie.defaults, this.settings.plugins.cookie); + if(opts.types[type] !== true) return false; + switch(type) { + case "selected": + if(this.settings.rules.multiple != false && this.selected_arr.length > 1) { + var val = Array(); + $.each(this.selected_arr, function () { + if(this.attr("id")) { val.push(this.attr("id")); } + }); + val = val.join(","); + } + else var val = this.selected ? this.selected.attr("id") : false; + $.cookie(opts.prefix + 'selected', val, opts.options); + break; + case "open": + var str = ""; + this.container.find("li.open").each(function (i) { if(this.id) { str += this.id + ","; } }); + $.cookie(opts.prefix + 'open', str.replace(/,$/ig,""), opts.options); + break; + } + }, + callbacks : { + oninit : function (t) { + var opts = $.extend(true, {}, $.tree.plugins.cookie.defaults, this.settings.plugins.cookie); + var tmp = false; + tmp = $.cookie(opts.prefix + 'open'); + if(tmp) { + tmp = tmp.split(","); + if(opts.keep_opened) this.settings.opened = $.unique($.merge(tmp, this.settings.opened)); + else this.settings.opened = tmp; + } + tmp = $.cookie(opts.prefix + 'selected'); + if(tmp) { + tmp = tmp.split(","); + if(opts.keep_selected) this.settings.selected = $.unique($.merge(tmp, this.settings.opened)); + else this.settings.selected = tmp; + } + }, + onchange : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["selected"]); }, + onopen : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["open"]); }, + onclose : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["open"]); }, + ondelete : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["open"]); }, + oncopy : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["open"]); }, + oncreate : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["open"]); }, + onmoved : function() { $.tree.plugins.cookie.set_cookie.apply(this, ["open"]); } + } + } + }); +})(jQuery); diff --git a/src/Backend/Modules/Pages/Js/jstree/plugins/jquery.tree.themeroller.js b/src/Backend/Modules/Pages/Js/jstree/plugins/jquery.tree.themeroller.js index 29b001e88e..037b351318 100644 --- a/src/Backend/Modules/Pages/Js/jstree/plugins/jquery.tree.themeroller.js +++ b/src/Backend/Modules/Pages/Js/jstree/plugins/jquery.tree.themeroller.js @@ -1,33 +1,33 @@ (function ($) { - $.extend($.tree.plugins, { - 'themeroller': { - defaults: { + $.extend($.tree.plugins, { + "themeroller" : { + defaults : { - }, - callbacks: { - oninit: function (t) { - if (this.settings.ui.theme_name != 'themeroller') return - var opts = $.extend(true, {}, $.tree.plugins.themeroller.defaults, this.settings.plugins.themeroller) - this.container.addClass('ui-widget ui-widget-content') - $('#' + this.container.attr('id') + ' li a').live('mouseover', function () { $(this).addClass('ui-state-hover') }) - $('#' + this.container.attr('id') + ' li a').live('mouseout', function () { $(this).removeClass('ui-state-hover') }) - }, - onparse: function (s, t) { - if (this.settings.ui.theme_name != 'themeroller') return - var opts = $.extend(true, {}, $.tree.plugins.themeroller.defaults, this.settings.plugins.themeroller) - return $(s).find('a').not('.ui-state-default').addClass('ui-state-default').children('ins').addClass('ui-icon').end().end().end() - }, - onselect: function (n, t) { - if (this.settings.ui.theme_name != 'themeroller') return - var opts = $.extend(true, {}, $.tree.plugins.themeroller.defaults, this.settings.plugins.themeroller) - $(n).children('a').addClass('ui-state-active') - }, - ondeselect: function (n, t) { - if (this.settings.ui.theme_name != 'themeroller') return - var opts = $.extend(true, {}, $.tree.plugins.themeroller.defaults, this.settings.plugins.themeroller) - $(n).children('a').removeClass('ui-state-active') - } - } - } - }) -})(jQuery) + }, + callbacks : { + oninit : function (t) { + if(this.settings.ui.theme_name != "themeroller") return; + var opts = $.extend(true, {}, $.tree.plugins.themeroller.defaults, this.settings.plugins.themeroller); + this.container.addClass("ui-widget ui-widget-content"); + $("#" + this.container.attr("id") + " li a").live("mouseover", function () { $(this).addClass("ui-state-hover"); }); + $("#" + this.container.attr("id") + " li a").live("mouseout", function () { $(this).removeClass("ui-state-hover"); }); + }, + onparse : function (s, t) { + if(this.settings.ui.theme_name != "themeroller") return; + var opts = $.extend(true, {}, $.tree.plugins.themeroller.defaults, this.settings.plugins.themeroller); + return $(s).find("a").not(".ui-state-default").addClass("ui-state-default").children("ins").addClass("ui-icon").end().end().end(); + }, + onselect : function(n, t) { + if(this.settings.ui.theme_name != "themeroller") return; + var opts = $.extend(true, {}, $.tree.plugins.themeroller.defaults, this.settings.plugins.themeroller); + $(n).children("a").addClass("ui-state-active"); + }, + ondeselect : function(n, t) { + if(this.settings.ui.theme_name != "themeroller") return; + var opts = $.extend(true, {}, $.tree.plugins.themeroller.defaults, this.settings.plugins.themeroller); + $(n).children("a").removeClass("ui-state-active"); + } + } + } + }); +})(jQuery);