diff options
Diffstat (limited to 'lib/scripts')
-rw-r--r-- | lib/scripts/behaviour.js | 2 | ||||
-rw-r--r-- | lib/scripts/compatibility.js | 2 | ||||
-rw-r--r-- | lib/scripts/editor.js | 6 | ||||
-rw-r--r-- | lib/scripts/fileuploaderextended.js | 4 | ||||
-rw-r--r-- | lib/scripts/jquery/jquery-ui-theme/smoothness.css | 4 | ||||
-rwxr-xr-x | lib/scripts/jquery/update.sh | 3 | ||||
-rw-r--r-- | lib/scripts/linkwiz.js | 13 | ||||
-rw-r--r-- | lib/scripts/media.js | 95 | ||||
-rw-r--r-- | lib/scripts/page.js | 4 | ||||
-rw-r--r-- | lib/scripts/qsearch.js | 4 |
10 files changed, 57 insertions, 80 deletions
diff --git a/lib/scripts/behaviour.js b/lib/scripts/behaviour.js index 20b408322..cffdde042 100644 --- a/lib/scripts/behaviour.js +++ b/lib/scripts/behaviour.js @@ -16,7 +16,7 @@ var dw_behaviour = { dw_behaviour.subscription(); dw_behaviour.revisionBoxHandler(); - jQuery('#page__revisions input[type=checkbox]').click( + jQuery('#page__revisions input[type=checkbox]').live('click', dw_behaviour.revisionBoxHandler ); }, diff --git a/lib/scripts/compatibility.js b/lib/scripts/compatibility.js index ea52153c5..385e45854 100644 --- a/lib/scripts/compatibility.js +++ b/lib/scripts/compatibility.js @@ -49,7 +49,7 @@ function DEPRECATED_WRAP(func, context) { * @link http://prototype.conio.net/ */ function $() { - DEPRECATED('Please use the JQuery() function instead.'); + DEPRECATED('Please use the jQuery() function instead.'); var elements = new Array(); diff --git a/lib/scripts/editor.js b/lib/scripts/editor.js index 2009ce6af..042e34608 100644 --- a/lib/scripts/editor.js +++ b/lib/scripts/editor.js @@ -61,9 +61,9 @@ var dw_editor = { jQuery.each([ ['larger', function(){dw_editor.sizeCtl(editor,100);}], ['smaller', function(){dw_editor.sizeCtl(editor,-100);}], - ['wrap', function(){dw_editor.toggleWrap(editor);}], + ['wrap', function(){dw_editor.toggleWrap(editor);}] ], function (_, img) { - jQuery(document.createElement('img')) + jQuery(document.createElement('IMG')) .attr('src', DOKU_BASE+'lib/images/' + img[0] + '.gif') .click(img[1]) .appendTo($ctl); @@ -130,7 +130,7 @@ var dw_editor = { * @param event e - the key press event object */ keyHandler: function(e){ - if([8, 13, 32].indexOf(e.keyCode) === -1) { + if(jQuery.inArray(e.keyCode,[8, 13, 32]) === -1) { return; } var selection = getSelection(this); diff --git a/lib/scripts/fileuploaderextended.js b/lib/scripts/fileuploaderextended.js index f92bdbc49..4abd63bef 100644 --- a/lib/scripts/fileuploaderextended.js +++ b/lib/scripts/fileuploaderextended.js @@ -55,9 +55,11 @@ qq.extend(qq.FileUploader.prototype, { qq.setText(fileElement, fileName); this._find(item, 'size').style.display = 'none'; + // name suggestion (simplified cleanID) var nameElement = this._find(item, 'nameInput'); fileName = fileName.toLowerCase(); - fileName = fileName.replace(/([^a-z0-9_\.\-]+)/g, '_'); + fileName = fileName.replace(/([ !"#$%&\'()+,\/;<=>?@[\]^`{|}~:]+)/g, '_'); + fileName = fileName.replace(/^_+/,''); nameElement.value = fileName; nameElement.id = 'mediamanager__upload_item'+id; diff --git a/lib/scripts/jquery/jquery-ui-theme/smoothness.css b/lib/scripts/jquery/jquery-ui-theme/smoothness.css index 0f1a7e770..910d24b95 100644 --- a/lib/scripts/jquery/jquery-ui-theme/smoothness.css +++ b/lib/scripts/jquery/jquery-ui-theme/smoothness.css @@ -56,9 +56,9 @@ /* Component containers ----------------------------------*/ -.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } +.ui-widget { font-size: 1.1em; } .ui-widget .ui-widget { font-size: 1em; } -.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-size: 1em; } .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } .ui-widget-content a { color: #222222; } .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } diff --git a/lib/scripts/jquery/update.sh b/lib/scripts/jquery/update.sh index 38f38bece..fde46f4d7 100755 --- a/lib/scripts/jquery/update.sh +++ b/lib/scripts/jquery/update.sh @@ -23,3 +23,6 @@ for img in $images do wget -nv https://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/smoothness/$img -O jquery-ui-theme/$img done + +# remove font family declarations from smoothness CSS +sed -i "s/font-family:[^;]*; \?//" jquery-ui-theme/smoothness.css diff --git a/lib/scripts/linkwiz.js b/lib/scripts/linkwiz.js index cc4c19e0d..5075a0ab8 100644 --- a/lib/scripts/linkwiz.js +++ b/lib/scripts/linkwiz.js @@ -35,14 +35,13 @@ var dw_linkwiz = { ) .parent() .attr('id','link__wiz') - .addClass('a11y') .css({ 'position': 'absolute', 'top': (pos.top+20)+'px', 'left': (pos.left+80)+'px' }) - .show() - .appendTo('div.dokuwiki'); + .hide() + .appendTo('.dokuwiki:first'); dw_linkwiz.textArea = $editor[0]; dw_linkwiz.result = jQuery('#link__wiz_result')[0]; @@ -186,7 +185,7 @@ var dw_linkwiz = { */ resultClick: function(a){ dw_linkwiz.$entry.val(a.title); - if(a.title == '' || a.title.substr(-1) == ':'){ + if(a.title == '' || a.title.substr(a.title.length-1) == ':'){ dw_linkwiz.autocomplete_exec(); }else{ if (jQuery(a.nextSibling).is('span')) { @@ -283,7 +282,7 @@ var dw_linkwiz = { */ show: function(){ dw_linkwiz.selection = getSelection(dw_linkwiz.textArea); - dw_linkwiz.$wiz.removeClass('a11y'); + dw_linkwiz.$wiz.show(); dw_linkwiz.$entry.focus(); dw_linkwiz.autocomplete(); }, @@ -292,7 +291,7 @@ var dw_linkwiz = { * Hide the link wizard */ hide: function(){ - dw_linkwiz.$wiz.addClass('a11y'); + dw_linkwiz.$wiz.hide(); dw_linkwiz.textArea.focus(); }, @@ -300,7 +299,7 @@ var dw_linkwiz = { * Toggle the link wizard */ toggle: function(){ - if(dw_linkwiz.$wiz.hasClass('a11y')){ + if(dw_linkwiz.$wiz.css('display') == 'none'){ dw_linkwiz.show(); }else{ dw_linkwiz.hide(); diff --git a/lib/scripts/media.js b/lib/scripts/media.js index 48bfdbbe8..841baa93f 100644 --- a/lib/scripts/media.js +++ b/lib/scripts/media.js @@ -135,7 +135,7 @@ var dw_mediamanager = { }); $sortBy.children('input').change(function (event) { dw_mediamanager.set_fileview_sort(); - dw_mediamanager.list.call(this, event); + dw_mediamanager.list.call(jQuery('#dw__mediasearch')[0] || this, event); }); }, @@ -253,8 +253,10 @@ var dw_mediamanager = { } } } - alignleft = dw_mediamanager.align === '2' ? '' : ' '; - alignright = dw_mediamanager.align === '4' ? '' : ' '; + if (dw_mediamanager.align !== '1') { + alignleft = dw_mediamanager.align === '2' ? '' : ' '; + alignright = dw_mediamanager.align === '4' ? '' : ' '; + } } } edid = String.prototype.match.call(document.location, /&edid=([^&]+)/); @@ -371,6 +373,10 @@ var dw_mediamanager = { if (typeof new_val === 'undefined') { new_val = jQuery('form.options li.' + opt[1] + ' input') .filter(':checked').val(); + // if new_val is still undefined (because form.options is not in active tab), set to most spacious option + if (typeof new_val === 'undefined') { + new_val = 'thumbs'; + } } if (new_val !== dw_mediamanager.view_opts[opt[0]]) { @@ -457,44 +463,6 @@ var dw_mediamanager = { }, window_resize: function () { - if (jQuery('#mediamanager__page').width() == dw_mediamanager.layout_width) { - return; - } - - dw_mediamanager.layout_width = jQuery('#mediamanager__page').width(); - $r = jQuery("#mediamanager__page div.panel"); - - var w = 0, wSum = 0, mCount = 0, mArray = []; - $r.each(function() { - w = jQuery(this).width(); - if (w == parseFloat(jQuery(this).css("min-width"))) { - wSum += w; - } else { - mArray[mCount] = jQuery(this); - mCount++; - } - }); - - if (mCount > 0) { - var width = (0.95 * jQuery('#mediamanager__page').width() - wSum - 30); - wSum = 0; - for(var i = 0; i < mArray.length; i++) { - wSum += mArray[i].width(); - } - for(var i = 0; i < mArray.length; i++) { - w = mArray[i].width(); - w = 100*w / wSum; - mArray[i].width(width*w/100); - } - } - - $r.each(function() { - w = jQuery(this).width(); - w = (100 * w / jQuery('#mediamanager__page').width()); - w += "%"; - jQuery(this).width(w); - }); - dw_mediamanager.resize(); dw_mediamanager.opacity_slider(); @@ -513,32 +481,37 @@ var dw_mediamanager = { update_resizable: function () { $resizables = dw_mediamanager.$resizables(); - $resizables.resizable({ handles: 'e' , + $resizables.resizable({ + handles: 'e', resize: function(event, ui){ - var w = 0; + var widthFull = jQuery('#mediamanager__page').width(); + var widthResizables = 0; $resizables.each(function() { - w += jQuery(this).width(); + widthResizables += jQuery(this).width(); }); - wSum = w + parseFloat(jQuery('#mediamanager__page div.file').css("min-width")); + var $filePanel = jQuery('#mediamanager__page div.panel.file'); - // max width of resizable column - var maxWidth = 0.95 * jQuery('#mediamanager__page').width() - wSum + jQuery(this).width() - 30; + // set max width of resizable column + var widthOtherResizable = widthResizables - jQuery(this).width(); + var minWidthNonResizable = parseFloat($filePanel.css("min-width")); + var maxWidth = widthFull - (widthOtherResizable + minWidthNonResizable); $resizables.resizable( "option", "maxWidth", maxWidth ); - // percentage width of the first two columns - var wLeft = ( 100*(w+30) / jQuery('#mediamanager__page').width() ); - - // width of the third column - var wRight = 95-wLeft; - wRight += "%"; - jQuery('#mediamanager__page div.file').width(wRight); - - $resizables.each(function() { - w = jQuery(this).width(); - w = (100 * w / jQuery('#mediamanager__page').width()); - w += "%"; - jQuery(this).width(w); - }); + // 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); + // set width of file panel + $filePanel.width(relWidthNonResizable+'%'); + + // FIXME: please fix without browser sniffing + if (!jQuery.browser.webkit) { + $resizables.each(function() { + w = jQuery(this).width(); + w = (99.99 * w / widthFull); + w += "%"; + jQuery(this).width(w); + }); + } dw_mediamanager.opacity_slider(); dw_mediamanager.portions_slider(); diff --git a/lib/scripts/page.js b/lib/scripts/page.js index e4033b76d..5da4a9cc0 100644 --- a/lib/scripts/page.js +++ b/lib/scripts/page.js @@ -43,7 +43,7 @@ dw_page = { * * @param target - the DOM element at which the popup should be aligned at * @param popup_id - the ID of the (new) DOM popup - * @return the Popup JQuery object + * @return the Popup jQuery object */ insituPopup: function(target, popup_id) { // get or create the popup div @@ -55,7 +55,7 @@ dw_page = { .attr('id', popup_id) .addClass('insitu-footnote JSpopup') .mouseleave(function () {jQuery(this).hide();}); - jQuery('div.dokuwiki:first').append($fndiv); + jQuery('.dokuwiki:first').append($fndiv); } // position() does not support hidden elements diff --git a/lib/scripts/qsearch.js b/lib/scripts/qsearch.js index c7128b9e3..a309f9e29 100644 --- a/lib/scripts/qsearch.js +++ b/lib/scripts/qsearch.js @@ -18,8 +18,8 @@ var dw_qsearch = { * * Attaches the event handlers * - * @param input element (JQuery selector/DOM obj) - * @param output element (JQuery selector/DOM obj) + * @param input element (jQuery selector/DOM obj) + * @param output element (jQuery selector/DOM obj) */ init: function (input, output) { var do_qsearch; |