Mercurial > moin > 2.0
changeset 1822:d7fb86b446ab
CSS and javascript changes to support obsolete IE7 and IE8 browsers,
add xstatic JSON-js package for IE7 user settings
author | Roger Haase <crosseyedpenguin@yahoo.com> |
---|---|
date | Thu, 27 Sep 2012 13:46:13 -0700 |
parents | 4c9c3321b92e |
children | 23ef0be1aec5 |
files | MoinMoin/templates/base.html MoinMoin/templates/common.js MoinMoin/templates/forms.html MoinMoin/themes/modernized/static/css/common.css MoinMoin/themes/modernized/static/css/stylus/main.styl setup.py wikiconfig.py |
diffstat | 7 files changed, 54 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/templates/base.html Sat Sep 22 15:31:00 2012 +0200 +++ b/MoinMoin/templates/base.html Thu Sep 27 13:46:13 2012 -0700 @@ -54,6 +54,10 @@ {# TODO: use a local copy later #} <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> + <!--[if lt IE 8]> + {# required to save user settings with IE7 and earlier #} + <script src="{{ url_for('serve.files', name='json_js', filename='json2.js') }}"></script> + <![endif]--> {% endblock %} {% endblock %} </head>
--- a/MoinMoin/templates/common.js Sat Sep 22 15:31:00 2012 +0200 +++ b/MoinMoin/templates/common.js Thu Sep 27 13:46:13 2012 -0700 @@ -24,7 +24,7 @@ function selected_link() { "use strict"; var selected = window.location.pathname, - list = document.getElementsByClassName('panel'), + list = $('.panel'), i, j, nav_links, @@ -500,19 +500,33 @@ // This anonymous function supports doubleclick to edit, auto-scroll the edit textarea and page after edit $(function () { // NOTE: if browser does not support sessionStorage, then auto-scroll is not available - // sessionStorage is supported by FF3.5+, Chrome4+, Safari4+, Opera10.5+, and IE8+ + // (sessionStorage is supported by FF3.5+, Chrome4+, Safari4+, Opera10.5+, and IE8+). + // IE8 does not scroll page after edit (cannot determine caret position within textarea). "use strict"; var TOPID = 'moin-content', LINENOATTR = "data-lineno", MESSAGEMISSED = ' {{ _("You missed! Double-click on text or to the right of text to auto-scroll text editor.") }} ', MESSAGEOBSOLETE = ' {{ _("Your browser is obsolete. Upgrade to gain auto-scroll text editor feature.") }} ', + MESSAGEOLD = ' {{ _("Your browser is old. Upgrade to gain auto-scroll page after edit feature.") }} ', OPERA = 'Opera', // special handling required because textareas have \r\n line endings modifyButton, lineno, message, caretLineno; + // IE8 workaround for missing setSelectionRange + function setSelection(textArea, charStart) { + // scroll IE8 textarea, target line will be near bottom of textarea + var range = textArea.createTextRange(); + range.collapse(true); + range.moveEnd('character', charStart); + range.moveStart('character', charStart); + range.select(); + //warn user that features are missing with IE8 + moinFlashMessage(MOINFLASHWARNING, MESSAGEOLD); + } + // called after +modify page loads -- scrolls the textarea after a doubleclick function scrollTextarea(jumpLine) { // jumpLine is textarea scroll-to line @@ -522,7 +536,7 @@ scrollAmount, textAreaClone; - if (textArea && textArea.setSelectionRange) { + if (textArea && (textArea.setSelectionRange || textArea.createTextRange)) { window.scrollTo(0, 0); // get data from textarea, split into array of lines, truncate based on jumpLine, make into a string textLines = $(textArea).val(); @@ -542,12 +556,18 @@ textAreaClone.rows = 1; scrollAmount = textAreaClone.scrollHeight - 100; // get total height of clone - 100 pixels textAreaClone.parentNode.removeChild(textAreaClone); - // position the caret, highlight the position of the caret for a second or so + // position the caret textArea.focus(); if (scrollAmount > 0) { textArea.scrollTop = scrollAmount; } - textArea.setSelectionRange(scrolledText.length, scrolledText.length + 8); - setTimeout(function () {textArea.setSelectionRange(scrolledText.length, scrolledText.length + 4); }, 1000); - setTimeout(function () {textArea.setSelectionRange(scrolledText.length, scrolledText.length); }, 1500); + if (textArea.setSelectionRange) { + // html5 compliant browsers, highlight the position of the caret for a second or so + textArea.setSelectionRange(scrolledText.length, scrolledText.length + 8); + setTimeout(function () {textArea.setSelectionRange(scrolledText.length, scrolledText.length + 4); }, 1000); + setTimeout(function () {textArea.setSelectionRange(scrolledText.length, scrolledText.length); }, 1500); + } else{ + // IE8 workaround to position the caret and scroll textarea + setSelection(textArea, scrolledText.length); + } } } @@ -616,6 +636,7 @@ if (textArea.selectionStart) { caretPoint = textArea.selectionStart; } else { + // IE7, IE8 or // IE9 - user has clicked ouside of textarea and textarea focus and caret position has been lost return 0; } @@ -630,7 +651,7 @@ } // doubleclick processing starts here - if (Storage !== "undefined") { + if (window.sessionStorage) { // Start of processing for "show" pages if (document.getElementById('moin-edit-on-doubleclick')) { // this is a "show" page and the edit on doubleclick option is set for this user @@ -668,7 +689,7 @@ $("#f_submit").click(function () { caretLineno = getCaretLineno(document.getElementById('f_content_form_data_text')); // save lineno for use in "show" page load - sessionStorage.moinCaretLineNo = caretLineno; + if (caretLineno > 0) { sessionStorage.moinCaretLineNo = caretLineno; } }); } }
--- a/MoinMoin/templates/forms.html Sat Sep 22 15:31:00 2012 +0200 +++ b/MoinMoin/templates/forms.html Thu Sep 27 13:46:13 2012 -0700 @@ -20,7 +20,7 @@ {% endmacro %} {% macro render_button(text) %} - <button>{{ text }}</button> + <button type="submit">{{ text }}</button> {% endmacro %} {% macro render_textcha(gen, form) %}
--- a/MoinMoin/themes/modernized/static/css/common.css Sat Sep 22 15:31:00 2012 +0200 +++ b/MoinMoin/themes/modernized/static/css/common.css Thu Sep 27 13:46:13 2012 -0700 @@ -284,7 +284,7 @@ #options dt{margin-left:10%;text-align:left;width:61%;margin-top:1.3em} #moin-usersettings a{color:#00008b} .moin-tab-titles{margin:0;padding:-10px 0 0;list-style:none;border-bottom:3px solid #4e7da9} -.moin-tab-titles li{display:inline-block;margin:10px 0 -3px;padding:0 5px;border-bottom:3px solid #4e7da9} +.moin-tab-titles li{display:inline-block;*display:inline;zoom:1;margin:10px 0 -3px;padding:0 5px;border-bottom:3px solid #4e7da9} .moin-tab-titles a{display:inline-block;padding:4px;background-color:#eef1f6;border-width:1px 1px 0;border-style:solid;border-color:#4e7da9;color:#00008b;border-top-left-radius:7px;border-top-right-radius:7px} .moin-tab-titles a:hover{background-color:#d8dfe9;text-decoration:none} .moin-tab-titles a.current{background:#d8dfe9;padding-top:8px;margin-top:-4px} @@ -366,7 +366,7 @@ .moin-item-index div.selected-item .moin-select-item{background-image:url("../img/moin-checkbox-on.png")} .moin-align-right{text-align:right;float:right} .moin-align-right ul{margin:0;padding:0} -.moin-align-right ul li.action-bar{list-style-type:none;display:inline-block} +.moin-align-right ul li.action-bar{list-style-type:none;display:inline-block;*display:inline;zoom:1} .moin-contenttypes-wrapper{position:relative;margin:0;color:#00008b;background:#eef1f6;border:1px solid #4e7da9;min-width:12em;text-align:left} .moin-contenttypes-wrapper div{cursor:pointer;margin:.1em;padding:.5em 1.2em .5em .5em;height:1em} div.ct-shown{background:#d8dfe9 url("../img/moin-movedown.png") no-repeat center right;color:#000} @@ -470,7 +470,7 @@ #moin-navibar li:hover{background:#d8dfe9} #moin-pageline{clear:both;margin:4px 10px;padding:0;width:auto;height:1px;border-bottom:1px solid #fff;border-top:1px solid #fff;background:#fff} .moin-itemviews{clear:both;display:block;margin:0 0 -6px 0;padding:2px 8px;background:#708090;font-size:.8em;border-radius:9px;color:#fff} -.moin-itemviews li{display:inline-block;padding:0;margin:4px 6px;line-height:1em} +.moin-itemviews li{display:inline-block;*display:inline;zoom:1;padding:0;margin:4px 6px;line-height:1em} .moin-itemviews a,.moin-itemviews a:visited{color:#cfcfcf;} .moin-itemviews a:hover,.moin-itemviews a:visited:hover{color:#fff} .moin-itemviews a:hover{text-decoration:underline} @@ -494,10 +494,10 @@ #moin-pageinfo,#moin-wikilicense,#moin-credits,#moin-version,#moin-timings{margin:10px 20px;text-align:left;font-size:.7em;color:#737373;} #moin-pageinfo a,#moin-wikilicense a,#moin-credits a,#moin-version a,#moin-timings a{color:#737373} #moin-pageinfo{margin-top:20px} -#moin-timings li{display:inline-block;margin:0 20px 0 0} +#moin-timings li{display:inline-block;*display:inline;zoom:1;margin:0 20px 0 0} #moin-credits span{display:inline-block;margin:0 5px} #moin-creditlogos{float:right;list-style:none;margin:5px 10px} -#moin-creditlogos li{display:inline-block;margin:10px 0 10px 10px} +#moin-creditlogos li{display:inline-block;*display:inline;zoom:1;margin:10px 0 10px 10px} .moin-item-wrapper{position:relative;display:inline-block} div.moin-item-wrapper{width:100%} .moin-item-wrapper > a:hover{color:#1f9ae0;text-decoration:none}
--- a/MoinMoin/themes/modernized/static/css/stylus/main.styl Sat Sep 22 15:31:00 2012 +0200 +++ b/MoinMoin/themes/modernized/static/css/stylus/main.styl Thu Sep 27 13:46:13 2012 -0700 @@ -452,6 +452,8 @@ .moin-tab-titles li display inline-block + *display: inline; // IE7 hack to display title tabs in a row ... + zoom: 1; // IE7 hack ... rather than a column margin 10px 0 -3px padding 0 5px border-bottom 3px solid border_color @@ -829,6 +831,8 @@ .moin-align-right ul li.action-bar list-style-type none display inline-block + *display: inline; // IE7 hack to display index action bar in a row ... + zoom: 1; // IE7 hack ... rather than a column .moin-contenttypes-wrapper position relative @@ -1336,6 +1340,8 @@ .moin-itemviews li display inline-block + *display: inline; // IE7 hack to display itemviews in a row ... + zoom: 1; // IE7 hack ... rather than a column padding 0 margin 4px 6px line-height 1em @@ -1456,6 +1462,8 @@ #moin-timings li display inline-block + *display: inline; // IE7 hack to display timings in a row ... + zoom: 1; // IE7 hack ... rather than a column margin 0 20px 0 0 #moin-credits span @@ -1469,6 +1477,8 @@ #moin-creditlogos li display inline-block + *display: inline; // IE7 hack to display credit logos in a row ... + zoom: 1; // IE7 hack ... rather than a column margin 10px 0 10px 10px .moin-item-wrapper
--- a/setup.py Sat Sep 22 15:31:00 2012 +0200 +++ b/setup.py Thu Sep 27 13:46:13 2012 -0700 @@ -100,8 +100,9 @@ 'pdfminer', # pdf -> text/plain conversion 'XStatic>=0.0.2', # support for static file pypi packages 'XStatic-CKEditor>=3.6.1.2', - 'XStatic-jQuery>=1.6.1.4', + 'XStatic-jQuery>=1.8.2', 'XStatic-jQuery-File-Upload>=4.4.2', + 'XStatic-JSON-js', 'XStatic-svgweb>=2011.2.3.2', 'XStatic-TWikiDraw-moin>=2004.10.23.2', 'XStatic-AnyWikiDraw>=0.14.2',
--- a/wikiconfig.py Sat Sep 22 15:31:00 2012 +0200 +++ b/wikiconfig.py Thu Sep 27 13:46:13 2012 -0700 @@ -61,7 +61,9 @@ ) # see https://bitbucket.org/thomaswaldmann/xstatic for infos about xstatic: from xstatic.main import XStatic + # names below must be package names mod_names = ['jquery', 'jquery_file_upload', + 'json_js', 'ckeditor', 'svgweb', 'svgedit_moin', 'twikidraw_moin', 'anywikidraw',