Commits

Roger Haase committed d7fb86b

CSS and javascript changes to support obsolete IE7 and IE8 browsers,
add xstatic JSON-js package for IE7 user settings

  • Participants
  • Parent commits 4c9c332

Comments (0)

Files changed (7)

File MoinMoin/templates/base.html

         {# 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>

File MoinMoin/templates/common.js

 function selected_link() {
     "use strict";
     var selected = window.location.pathname,
-        list = document.getElementsByClassName('panel'),
+        list = $('.panel'),
         i,
         j,
         nav_links,
 // 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
             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();
             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);
+            }
         }
     }
 
         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;
         }
     }
 
     // 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
                 $("#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; }
                 });
             }
         }

File MoinMoin/templates/forms.html

 {% endmacro %}
 
 {% macro render_button(text) %}
-  <button>{{ text }}</button>
+  <button type="submit">{{ text }}</button>
 {% endmacro %}
 
 {% macro render_textcha(gen, form) %}

File MoinMoin/themes/modernized/static/css/common.css

 #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}
 .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}
 #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}
 #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}

File MoinMoin/themes/modernized/static/css/stylus/main.styl

 
 .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
 .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
 
 .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
 
 #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
 
 #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
         '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',

File wikiconfig.py

     )
     # 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',