Merge remote branch 'origin/master' into wosch
authorWolfram Schneider <wosch@indexdata.dk>
Wed, 10 Jul 2013 12:16:30 +0000 (12:16 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Wed, 10 Jul 2013 12:16:30 +0000 (12:16 +0000)
examples/htdocs/index-mike.html
examples/htdocs/index-mobile.html
tools/htdocs/mkws.js
tools/htdocs/mkwsStyle.css

index 930e19a..b3cad34 100644 (file)
@@ -6,7 +6,7 @@
     <script type="text/javascript">
       var mkws_config = {
        responsive_design: true,
-       responsive_design_width: 990,
+       responsive_design_width: 600
       };
     </script>
     <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
@@ -20,6 +20,5 @@
     <div id="mkwsResults"></div>
     <div id="mkwsTargets"></div>
     <div id="mkwsStat"></div>
-    <div id="mkwsShiftedTermlists"></div>
   </body>
 </html>
index 02f4342..bf1893f 100644 (file)
     <div id="mkwsSearch"></div>
     <div id="mkwsResults"></div>
     <div id="mkwsTargets"></div>
-
-    <div id="mkwsShiftedTermlists"></div>
-
-    <div id="footer">
-      <div id="mkwsStat"></div>
-      <span>Powered by MKWS &copy; 2013 <a target="_new" href="http://www.indexdata.com">Index Data</a></span>
-    </div>
+    <div id="mkwsStat"></div>
   </body>
 </html>
index f1b3fb1..fc79eb9 100644 (file)
@@ -198,10 +198,6 @@ function my_onterm(data) {
 
     var termlist = document.getElementById("mkwsTermlists");
     replaceHtml(termlist, acc.join(''));
-
-    // ### I don't believe these lines should be necessary (but they are)
-    if (mkws_config.responsive_design)
-        mkws_mobile_resize();
 }
 
 function add_single_facet(acc, caption, data, max, cclIndex) {
@@ -532,7 +528,7 @@ function mkws_html_all(config) {
        perpage_menu: true,     /* show/hide perpage menu */
        lang_display: [],       /* display languages links for given languages, [] for all */
        facets: ["sources", "subjects", "authors"], /* display facets, in this order, [] for none */
-       responsive_design_width: 980, /* a page with less pixel width considered as mobile */
+       responsive_design_width: 980, /* a page with less pixel width considered as narrow */
        debug: 1,     /* debug level for development: 0..2 */
 
        dummy: "dummy"
@@ -583,7 +579,7 @@ function mkws_html_all(config) {
        $("#mkwsResults").html('\
       <table width="100%" border="0" cellpadding="6" cellspacing="0">\
         <tr>\
-          <td width="250" valign="top">\
+          <td id="mkwsTermlistContainer1" width="250" valign="top">\
             <div id="mkwsTermlists"></div>\
           </td>\
           <td id="mkwsMOTDContainer" valign="top">\
@@ -593,6 +589,11 @@ function mkws_html_all(config) {
             <div id="mkwsRecords"></div>\
           </td>\
         </tr>\
+        <tr>\
+          <td colspan="2">\
+            <div id="mkwsTermlistContainer2"></div>\
+          </td>\
+        </tr>\
       </table>');
     }
 
@@ -618,9 +619,9 @@ function mkws_html_all(config) {
     if (mkws_config.responsive_design) {
        // Responsive web design - change layout on the fly based on
        // current screen width. Required for mobile devices.
-       $(window).resize( function(e) { mkws_mobile_resize() });
+       $(window).resize( function(e) { mkws_resize_page() });
        // initial check after page load
-       $(document).ready(function() { mkws_mobile_resize() });
+       $(document).ready(function() { mkws_resize_page() });
     }
 
     domReady();
@@ -780,28 +781,30 @@ function mkws_html_lang(mkws_config) {
     $("#mkwsLang").html(data);
 }
 
-function mkws_mobile_resize () {
-    debug("resize width: " + $(window).height() + ", width: " + $(window).width());
+function mkws_resize_page () {
     var list = ["mkwsSwitch"];
-    var obj;
-    // alert($(window).width());
 
     var width = mkws_config.responsive_design_width || 980;
-
-    if ($(window).width() <= width) {
+    var parentId = $("#mkwsTermlists").parent().attr('id');
+
+    if ($(window).width() <= width &&
+       parentId === "mkwsTermlistContainer1") {
+       debug("changing from wide to narrow: " + $(window).width());
+       $("#mkwsTermlists").appendTo($("#mkwsTermlistContainer2"));
+       $("#mkwsTermlistContainer1").hide();
+       $("#mkwsTermlistContainer2").show();
        for(var i = 0; i < list.length; i++) {
            $("#" + list[i]).hide();
        }
-
-       $("#mkwsTermlists").hide();
-       obj = $("#mkwsTermlists").html();
-        $("#mkwsShiftedTermlists").html(obj);
-    } else {
+    } else if ($(window).width() > width &&
+       parentId === "mkwsTermlistContainer2") {
+       debug("changing from narrow to wide: " + $(window).width());
+       $("#mkwsTermlists").appendTo($("#mkwsTermlistContainer1"));
+       $("#mkwsTermlistContainer1").show();
+       $("#mkwsTermlistContainer2").hide();
        for(var i = 0; i < list.length; i++) {
            $("#" + list[i]).show();
        }
-       $("#mkwsTermlists").show();
-       $("#mkwsShiftedTermlists").html("");
     }
 };
 
index 1571da7..b807ed3 100644 (file)
@@ -8,7 +8,6 @@
 #mkwsRecords,
 #mkwsTargets,
 #mkwsStat,
-#mkwsShiftedTermlists,
 #mkwsMOTD {
     font-family: Gill Sans, "Gillius ADF", Gillius, GilliusADF, Verdana, Sans-Serif;
 }
@@ -68,8 +67,7 @@
 #mkwsRanking a,
 #mkwsPager a,
 #mkwsNavi a,
-#mkwsRecords a,
-#mkwsShiftedTermlists a {
+#mkwsRecords a {
     color: #005701;
     text-decoration: none;
 }
@@ -78,8 +76,7 @@
 #mkwsLang a:hover,
 #mkwsTermlists a:hover,
 #mkwsPager a:hover,
-#mkwsRecords a:hover,
-#mkwsShiftedTermlists a:hover {
+#mkwsRecords a:hover {
     text-decoration: underline;
 }
 
     background: #f0f8ff;
 }
 
-#mkwsTermlists .title,
-#mkwsShiftedTermlists .title {
+#mkwsTermlists .title {
     font-size: large;
     font-weight: bold;
     text-transform: uppercase;
 }
 
-#mkwsTermlists,
-#mkwsShiftedTermlists div#termlist  {
+#mkwsTermlists {
     background: #d0e0ff;
     padding: 0.7em;
     font-size: small;
     -webkit-border-top-right-radius: 10px;
 }
 
-#mkwsTermlists div.facet,
-#mkwsShiftedTermlists div.facet {
+#mkwsTermlists div.facet {
     background: #e0f0ff;
     padding: 0.7em;
     margin-top: 0.7em;
     -webkit-border-top-right-radius: 10px;
 }
 
-#mkwsTermlists div.termtitle,
-#mkwsShiftedTermlists div.termtitle {
+#mkwsTermlists div.termtitle {
     font-weight: bold;
 }
 
-#mkwsRecords div.record,
-#mkwsShiftedTermlists div.record {
+#mkwsRecords div.record {
     padding: 5px;
 }
 
     -webkit-border-top-right-radius: 10px;
 }
 
-#mkwsRecords div.details th,
-#mkwsShiftedTermlists div.details th {
+#mkwsRecords div.details th {
     text-align: right;
     vertical-align: top;
     padding-right: 0.6em;
 }
 
-#mkwsRecords div.details th:after,
-#mkwsShiftedTermlists div.details th:after {
+#mkwsRecords div.details th:after {
     content: ":";
 }