From 60443fd414c246e3186f0f746a56ba610532faa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jana=20Deutschla=CC=88nder?= Date: Wed, 3 May 2017 16:46:58 +0200 Subject: [PATCH 1/3] more spacing between nav main nav tools and starred --- css/area_main-sidebar-nav.less | 10 ++-- css/plugins/starred.less | 1 + js/base/helper.js | 85 ---------------------------------- 3 files changed, 8 insertions(+), 88 deletions(-) delete mode 100755 js/base/helper.js diff --git a/css/area_main-sidebar-nav.less b/css/area_main-sidebar-nav.less index 618e8c3..f5688c0 100755 --- a/css/area_main-sidebar-nav.less +++ b/css/area_main-sidebar-nav.less @@ -34,6 +34,9 @@ } nav { + &.nav-main { + margin-bottom: 1rem; + } > p { color: @ini_nav_menu_color; @@ -230,14 +233,15 @@ strong { display: inline-block; font-size: @icon-size * 0.5; - width: @icon-size * 0.9; - height: @icon-size * 0.9; + width: @icon-size * 0.98; + height: @icon-size * 0.98; line-height: @icon-size * 0.9; margin: @icon-size * 0.05; + padding: 0 .05em .05em; vertical-align: baseline; text-align: center; color: inherit; - border: 2px solid @ini_nav_menu_color; + border: 2px solid fade(@ini_nav_menu_color, 80%); border-top-right-radius: 50%; border-bottom-left-radius: 50%; } diff --git a/css/plugins/starred.less b/css/plugins/starred.less index a43c04d..cdb371f 100644 --- a/css/plugins/starred.less +++ b/css/plugins/starred.less @@ -28,6 +28,7 @@ } nav.nav-starred { + margin-top: 1rem; ul { list-style: none; &#sidebar-menu-starred { diff --git a/js/base/helper.js b/js/base/helper.js deleted file mode 100755 index 170773b..0000000 --- a/js/base/helper.js +++ /dev/null @@ -1,85 +0,0 @@ -/** - * @file helper funcs - * - */ - -// + + + + + + + + + + + + + + + + + + + + + + + + + + + + -// shuffle func for random values -// + + + + + + + + + + + + + + + + + + + + + + + + + + + + -Array.prototype.shuffle = function(){ - var tmp, rand; - for(var i =0; i < this.length; i++){ - rand = Math.floor(Math.random() * this.length); - tmp = this[i]; - this[i] = this[rand]; - this[rand] =tmp; - } -}; -// + + + + + + + + + + + + + + + + + + + + + + + + + + + + -// js trim func for ie -// + + + + + + + + + + + + + + + + + + + + + + + + + + + + -if(typeof String.prototype.trim !== 'function') { - String.prototype.trim = function() { - return this.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); - }; -} -var linkTo_UnCryptMailto = function(s){ - location.href=decryptString(s,-2); -}; -var decryptCharcode = function(n, start, end, offset) { - n = n + offset; - if (offset > 0 && n > end) { - n = start + (n - end - 1); - } else if (offset < 0 && n < start) { - n = end - (start - n - 1); - } - return String.fromCharCode(n); -}; -var decryptString = function(enc, offset) { - var dec = ''; - var len = enc.length; - for (var i = 0; i < len; i++) { - var n = enc.charCodeAt(i); - if (n >= 43 && n <= 58) { - dec += decryptCharcode(n, 43, 58, offset); - } else if (n >= 64 && n <= 90) { - dec += decryptCharcode(n, 64, 90, offset); - } else if (n >= 97 && n <= 122) { - dec += decryptCharcode(n, 97, 122, offset); - } else { - dec += enc.charAt(i); - } - } - return dec; -}; -/** - * simplify setting and getting state out of a node - * $("#my_id").data("my_data_attr") equals $$("#my_id").my_data_attr and - * $("#my_id").data("my_data_attr", "my_data_val") equals $$("#my_id").my_data_attr = my_data_val - * you can also do - * $$("#my_id").my_data_val = $$("#my_id").my_data_val + 1. - */ -var $$ = function(param) { - var node = $(param)[0]; - var id = $.data(node); - $.cache[id] = $.cache[id] || {}; - $.cache[id].node = node; - return $.cache[id]; -}; -var alertFB = false; -if (typeof console === "undefined" || typeof console.log === "undefined") { - console = {}; - if (alertFB) { - console.log = function(msg) { - alert(msg); - }; - } else { - console.log = function() {}; - } -} - -var wikiLang = "de"; -/** - * anonymous func: get page language - */ -(function($){ $("html").attr("lang"); if(typeof(l)!= 'undefined' && l.length>=2) wikiLang=l.substr(0,2).toLowerCase(); if(wikiLang!='de'&& wikiLang!='en') wikiLang='de'; })(jQuery); From c5e825b2e3b7205ba6c3063371f57738b2e20314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jana=20Deutschla=CC=88nder?= Date: Wed, 3 May 2017 16:47:52 +0200 Subject: [PATCH 2/3] bugfix breadcrumb not clickable in wide content view --- css/area_main-sidebar-search.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/area_main-sidebar-search.less b/css/area_main-sidebar-search.less index 77a7552..45567e5 100644 --- a/css/area_main-sidebar-search.less +++ b/css/area_main-sidebar-search.less @@ -194,7 +194,7 @@ z-index: 1; display: block; float: left; - width: 100%; + width: auto; } form { From c6a2583846ad056de1935f5ca1179b240a049e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jana=20Deutschla=CC=88nder?= Date: Wed, 3 May 2017 16:53:42 +0200 Subject: [PATCH 3/3] SPR-980: close meta box after click on TOC anchor --- js/base/spc.js | 62 ++++++++++++++++++++++++++++++++++++++++++++++ js/meta-box.js | 67 ++++++++++++++++++++++++++++---------------------- 2 files changed, 100 insertions(+), 29 deletions(-) diff --git a/js/base/spc.js b/js/base/spc.js index 608ea3d..8ff1abd 100755 --- a/js/base/spc.js +++ b/js/base/spc.js @@ -195,3 +195,65 @@ } } }; + + +// + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// shuffle func for random values +// + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Array.prototype.shuffle = function(){ + var tmp, rand; + for(var i =0; i < this.length; i++){ + rand = Math.floor(Math.random() * this.length); + tmp = this[i]; + this[i] = this[rand]; + this[rand] =tmp; + } +}; + +// + + + + + + + + + + + + + + + + + + + + + + + + + + + + +// js trim func for ie +// + + + + + + + + + + + + + + + + + + + + + + + + + + + + +if(typeof String.prototype.trim !== 'function') { + String.prototype.trim = function() { + return this.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); + }; +} + +/** + * simplify setting and getting state out of a node + * $("#my_id").data("my_data_attr") equals $$("#my_id").my_data_attr and + * $("#my_id").data("my_data_attr", "my_data_val") equals $$("#my_id").my_data_attr = my_data_val + * you can also do + * $$("#my_id").my_data_val = $$("#my_id").my_data_val + 1. + */ +var $$ = function(param) { + var node = $(param)[0]; + var id = $.data(node); + $.cache[id] = $.cache[id] || {}; + $.cache[id].node = node; + return $.cache[id]; +}; +var alertFB = false; +if (typeof console === "undefined" || typeof console.log === "undefined") { + console = {}; + if (alertFB) { + console.log = function(msg) { + alert(msg); + }; + } else { + console.log = function() {}; + } +} + +/** + * custom event handler ‘show’/’hide’ events for using .on() + */ +(function ($) { + $.each(['show', 'hide'], function (i, e) { + var el = $.fn[e]; + $.fn[e] = function () { + this.trigger(e); + return el.apply(this, arguments); + }; + }); +})(jQuery); diff --git a/js/meta-box.js b/js/meta-box.js index 238e743..c9b99aa 100755 --- a/js/meta-box.js +++ b/js/meta-box.js @@ -16,12 +16,44 @@ */ var registerClickForTabsInMetaBox = function($metaBox) { - $metaBox.on('click', '.meta-tabs a', function (e) { - e.preventDefault(); - var $tab = $(this), - isopen = $tab.attr('aria-expanded') === 'true'; + $metaBox.on('click', '.meta-tabs a', function (e) { + e.preventDefault(); + var $tab = $(this), + isopen = $tab.attr('aria-expanded') === 'true'; - // disable all existing tabs + // disable all existing tabs + disableExistingTabs($metaBox); + + + if (isopen) return; // tab was open, we closed it. we're done + + // enable current tab + $tab + .attr('aria-expanded', 'true') + .closest('li') + .addClass('active'); + $metaBox.find($tab.attr('href')) + .addClass('active') + .attr('aria-hidden', 'false'); + + }).find('.meta-content').on('click', 'a[href*="#"]', function (e) { + disableExistingTabs($metaBox); + /* uses custome event handler hide see spc.js */ + }).find('#tagging__edit').on('hide', function(e){ + disableExistingTabs($metaBox); + }); + + /** + * in admin templates show toc tab, if available + */ + if($('body').hasClass('do-admin')) { + var $tocLink = $metaBox.find('a[href="#spr__tab-toc"]'); + if($tocLink.length === 1) { + $tocLink.trigger('click'); + } + } + }, + disableExistingTabs = function($metaBox) { $metaBox.find('.meta-tabs li') .removeClass('active') .find('a') @@ -29,30 +61,7 @@ $metaBox.find('.meta-content .tab-pane') .removeClass('active') .attr('aria-hidden', 'false'); - - if (isopen) return; // tab was open, we closed it. we're done - - // enable current tab - $tab - .attr('aria-expanded', 'true') - .closest('li') - .addClass('active'); - $metaBox.find($tab.attr('href')) - .addClass('active') - .attr('aria-hidden', 'false'); - - }); - - /** - * in admin templates show toc tab, if available - */ - if($('body').hasClass('do-admin')) { - var $tocLink = $metaBox.find('a[href="#spr__tab-toc"]'); - if($tocLink.length === 1) { - $tocLink.trigger('click'); - } - } - }; + }; $(function(){