From 5b838199e985590c6d716cd6add1973fcfd0d54c Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 26 Aug 2012 16:20:57 +0200 Subject: do not intialize media manager JS if not needed FS#2578 --- lib/scripts/media.js | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/scripts') diff --git a/lib/scripts/media.js b/lib/scripts/media.js index 1872f2c61..074c7b95f 100644 --- a/lib/scripts/media.js +++ b/lib/scripts/media.js @@ -31,6 +31,7 @@ var dw_mediamanager = { var $content, $tree; $content = jQuery('#media__content'); $tree = jQuery('#media__tree'); + if(!$tree.length) return; dw_mediamanager.prepare_content($content); -- cgit v1.2.3 From 10295f78866be6074f00369aa219c67d867ad610 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sat, 8 Sep 2012 10:50:41 +0200 Subject: Replace language-dependent selector in the mediamanager js FS#2573 --- lib/scripts/media.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/scripts') diff --git a/lib/scripts/media.js b/lib/scripts/media.js index 074c7b95f..a85b2ed0f 100644 --- a/lib/scripts/media.js +++ b/lib/scripts/media.js @@ -435,7 +435,7 @@ var dw_mediamanager = { dw_mediamanager.$resizables().resizable('destroy'); if (update_list) { - dw_mediamanager.list.call(jQuery('input[value="Apply"]')[0]); + dw_mediamanager.list.call(jQuery('#mediamanager__page form.options input[type="submit"]')[0]); } $content.html(data); -- cgit v1.2.3 From e9e762792aaa754e29c2ecbbd088b60f75b7d674 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sun, 9 Sep 2012 00:39:37 +0200 Subject: Add more tolerance in js resize of the media manager FS#2369 This adds more tolerance to the width calculations of the media manager panes which avoids that the right pane is displayed below the other panes. --- lib/scripts/media.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/scripts') diff --git a/lib/scripts/media.js b/lib/scripts/media.js index a85b2ed0f..8f3c00c88 100644 --- a/lib/scripts/media.js +++ b/lib/scripts/media.js @@ -495,12 +495,12 @@ var dw_mediamanager = { // set max width of resizable column var widthOtherResizable = widthResizables - jQuery(this).width(); var minWidthNonResizable = parseFloat($filePanel.css("min-width")); - var maxWidth = widthFull - (widthOtherResizable + minWidthNonResizable); + var maxWidth = widthFull - (widthOtherResizable + minWidthNonResizable) - 1; $resizables.resizable( "option", "maxWidth", maxWidth ); // width of file panel in % = 100% - width of resizables in % - // this calculates with 99.99 and not 100 to overcome rounding errors - var relWidthNonResizable = 99.99 - (100 * widthResizables / widthFull); + // this calculates with 99.9 and not 100 to overcome rounding errors + var relWidthNonResizable = 99.9 - (100 * widthResizables / widthFull); // set width of file panel $filePanel.width(relWidthNonResizable+'%'); -- cgit v1.2.3 From 4802becf985a7e314243b0c4d0a30bd7f906d078 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sun, 9 Sep 2012 18:44:16 +0200 Subject: Fix section edit highlighting when the start marker is hidden This fixes the section edit highlighting when the start marker (normally a heading) is inside other HTML elements like a div from the wrap plugin. --- lib/scripts/page.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/scripts') diff --git a/lib/scripts/page.js b/lib/scripts/page.js index 5ac81f33b..b8e83cb0c 100644 --- a/lib/scripts/page.js +++ b/lib/scripts/page.js @@ -27,9 +27,14 @@ dw_page = { // Walk the DOM tree up (first previous siblings, then parents) // until boundary element while($tgt.length > 0 && !$tgt.hasClass('sectionedit' + nr)) { - // $.last gives the DOM-ordered last element: - // prev if present, else parent. - $tgt = $tgt.prev().add($tgt.parent()).last(); + // go down when the sectionedit begin marker is below $tgt + if ($tgt.find('.sectionedit' + nr).length > 0) { + $tgt = $tgt.children().last(); + } else { + // $.last gives the DOM-ordered last element: + // prev if present, else parent. + $tgt = $tgt.prev().add($tgt.parent()).last(); + } $tgt.addClass('section_highlight'); } }) -- cgit v1.2.3 From 30c1351e814dcc13497a61f65fa05a0901d5436a Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Mon, 10 Sep 2012 00:25:36 +0200 Subject: Fix media manager height handling after resize FS#2369 The height handling code was triggered before the width handling code and thus the right pane was below the other panes during the height calculations which caused strange effects. Now the height handling code is called again after adjusting the width of the right pane. --- lib/scripts/media.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/scripts') diff --git a/lib/scripts/media.js b/lib/scripts/media.js index 8f3c00c88..182d5fefe 100644 --- a/lib/scripts/media.js +++ b/lib/scripts/media.js @@ -514,6 +514,8 @@ var dw_mediamanager = { }); } + dw_mediamanager.resize(); + dw_mediamanager.opacity_slider(); dw_mediamanager.portions_slider(); } -- cgit v1.2.3 From 870c8a4b77dd7c2cfdc14045f8604b5bbf34c01e Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Fri, 12 Oct 2012 00:41:37 +0100 Subject: #2541, alter section highlighting to insert a container into the DOM to hold the elements being highlighted & later remove it --- lib/scripts/page.js | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'lib/scripts') diff --git a/lib/scripts/page.js b/lib/scripts/page.js index b8e83cb0c..4ab0bf9b5 100644 --- a/lib/scripts/page.js +++ b/lib/scripts/page.js @@ -22,24 +22,27 @@ dw_page = { jQuery('form.btn_secedit') .mouseover(function(){ var $tgt = jQuery(this).parent(), - nr = $tgt.attr('class').match(/(\s+|^)editbutton_(\d+)(\s+|$)/)[2]; - - // Walk the DOM tree up (first previous siblings, then parents) - // until boundary element - while($tgt.length > 0 && !$tgt.hasClass('sectionedit' + nr)) { - // go down when the sectionedit begin marker is below $tgt - if ($tgt.find('.sectionedit' + nr).length > 0) { - $tgt = $tgt.children().last(); - } else { - // $.last gives the DOM-ordered last element: - // prev if present, else parent. - $tgt = $tgt.prev().add($tgt.parent()).last(); - } - $tgt.addClass('section_highlight'); + nr = $tgt.attr('class').match(/(\s+|^)editbutton_(\d+)(\s+|$)/)[2], + $highlight = jQuery(), // holder for elements in the section to be highlighted + $highlightWrap = jQuery('
'); // section highlight wrapper + + // Walk the dom tree in reverse to find the sibling which is or contains the section edit marker + while($tgt.length > 0 && !($tgt.hasClass('sectionedit' + nr) || $tgt.find('.sectionedit' + nr).length)) { + $tgt = $tgt.prev(); + $highlight = $highlight.add($tgt); } + // insert the section highlight wrapper before the last element added to $highlight + $highlight.filter(':last').before($highlightWrap); + // and move the elements to be highlighted inside the section highlight wrapper + $highlight.detach().appendTo($highlightWrap); }) .mouseout(function(){ - jQuery('.section_highlight').removeClass('section_highlight'); + // find the section highlight wrapper... + var $highlightWrap = jQuery('.section_highlight'); + // ...move its children in front of it (as siblings)... + $highlightWrap.before($highlightWrap.children().detach()); + // ...and remove the section highlight wrapper + $highlightWrap.detach(); }); }, -- cgit v1.2.3 From a21383af58203bf0e6dc36a07ea78fae0b58c1ef Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 12 Nov 2012 20:57:27 +0100 Subject: crossbrowser fixes for quicksearch shortening FS#2660 fixes the problem with missing innerText in Firefox (and other browsers) and corrects shortening in regard to paddings and the use of the text-overflow attribute --- lib/scripts/qsearch.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'lib/scripts') diff --git a/lib/scripts/qsearch.js b/lib/scripts/qsearch.js index a309f9e29..c3d0d94fb 100644 --- a/lib/scripts/qsearch.js +++ b/lib/scripts/qsearch.js @@ -92,12 +92,18 @@ var dw_qsearch = { .show() .css('white-space', 'nowrap'); - // shorten namespaces if too long - max = dw_qsearch.$outObj[0].clientWidth; + // disable overflow during shortening + dw_qsearch.$outObj.find('li').css('overflow', 'visible'); + $links = dw_qsearch.$outObj.find('a'); - too_big = (document.documentElement.dir === 'rtl') - ? function (l) { return l.offsetLeft < 0; } - : function (l) { return l.offsetWidth + l.offsetLeft > max; }; + max = dw_qsearch.$outObj[0].clientWidth; // maximum width allowed (but take away paddings below) + if(document.documentElement.dir === 'rtl'){ + max -= parseInt(dw_qsearch.$outObj.css('padding-left')); + too_big = function (l) { return l.offsetLeft < 0; }; + }else{ + max -= parseInt(dw_qsearch.$outObj.css('padding-right')); + too_big = function (l) { return l.offsetWidth + l.offsetLeft > max; }; + } $links.each(function () { var start, length, replace, nsL, nsR, eli, runaway; @@ -106,6 +112,12 @@ var dw_qsearch = { return; } + // make IE's innerText available to W3C conform browsers + if(this.textContent){ + this.__defineGetter__('innerText', function(){ return this.textContent }); + this.__defineSetter__('innerText', function(val){ this.textContent = val }); + } + nsL = this.innerText.indexOf('('); nsR = this.innerText.indexOf(')'); eli = 0; @@ -138,6 +150,9 @@ var dw_qsearch = { nsR = this.innerText.indexOf(')'); } }); + + // reenable overflow + dw_qsearch.$outObj.find('li').css('overflow', 'hidden').css('text-overflow','ellipsis'); } }; -- cgit v1.2.3 From cc564ecd28a1cad0c52c4f2a2f682b2bed1ed01c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Schplurtz=20le=20D=C3=A9boulonn=C3=A9?= Date: Sun, 11 Nov 2012 11:18:47 +0100 Subject: compat js findPosX/y more closely mimic historical function --- lib/scripts/compatibility.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/scripts') diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index 385e45854..76b135b23 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -165,13 +165,13 @@ toggleWrap = DEPRECATED_WRAP(dw_editor.toggleWrap); setWrap = DEPRECATED_WRAP(dw_editor.setWrap); function findPosX(object){ - DEPRECATED('Use jQuery.position() instead'); - return jQuery(object).position().left; + DEPRECATED('Use jQuery.offset() instead'); + return jQuery(object).offset().left; } function findPosY(object){ - DEPRECATED('Use jQuery.position() instead'); - return jQuery(object).position().top; + DEPRECATED('Use jQuery.offset() instead'); + return jQuery(object).offset().top; } function getElementsByClass(searchClass,node,tag){ -- cgit v1.2.3