summaryrefslogtreecommitdiffstats
path: root/doc/src/template/scripts/narrow.js
diff options
context:
space:
mode:
authorMorten Engvoldsen <morten.engvoldsen@nokia.com>2010-06-02 08:17:09 (GMT)
committerMorten Engvoldsen <morten.engvoldsen@nokia.com>2010-06-02 08:17:09 (GMT)
commit65f4148dc8c2ecd6538c1e2313c633d65e2b7fcc (patch)
tree8f9643e7bf76b387a5c543c8c72ce1880bdffc71 /doc/src/template/scripts/narrow.js
parent179cc58660d4ba274ac95e39ed3cfb2845054121 (diff)
downloadQt-65f4148dc8c2ecd6538c1e2313c633d65e2b7fcc.zip
Qt-65f4148dc8c2ecd6538c1e2313c633d65e2b7fcc.tar.gz
Qt-65f4148dc8c2ecd6538c1e2313c633d65e2b7fcc.tar.bz2
Doc: adding offline docs to assistant and Qt Creator. Improving small docs and adding highlighting
Diffstat (limited to 'doc/src/template/scripts/narrow.js')
-rw-r--r--doc/src/template/scripts/narrow.js78
1 files changed, 78 insertions, 0 deletions
diff --git a/doc/src/template/scripts/narrow.js b/doc/src/template/scripts/narrow.js
new file mode 100644
index 0000000..12d0ce8
--- /dev/null
+++ b/doc/src/template/scripts/narrow.js
@@ -0,0 +1,78 @@
+var narrowInit = function() {
+ /* TODO:
+ Could probably be more efficient, not hardcoding each element to be created
+ */
+ // 1: Create search form
+ var narrowSearch = $('<div id="narrowsearch"></div>');
+ var searchform = $("#qtdocsearch");
+ narrowSearch.append(searchform);
+ $("#qtdocheader .content .qtref").after(narrowSearch);
+
+ // 2: Create dropdowns
+ var narrowmenu = $('<ul id="narrowmenu" class="sf-menu"></ul>');
+
+ // Lookup
+ var lookuptext = $("#lookup h2").attr("title");
+ $("#lookup ul").removeAttr("id");
+ $("#lookup ul li").removeAttr("class");
+ $("#lookup ul li").removeAttr("style");
+ var lookupul = $("#lookup ul");
+ var lookuplist = $('<li></li>');
+ var lookuplink = $('<a href="#"></a>');
+ lookuplink.append(lookuptext);
+ lookuplist.append(lookuplink);
+ lookuplist.append(lookupul);
+ narrowmenu.append(lookuplist);
+
+ // Topics
+ var topicstext = $("#topics h2").attr("title");
+ $("#topics ul").removeAttr("id");
+ $("#topics ul li").removeAttr("class");
+ $("#topics ul li").removeAttr("style");
+ var topicsul = $("#topics ul");
+ var topicslist = $('<li></li>');
+ var topicslink = $('<a href="#"></a>');
+ topicslink.append(topicstext);
+ topicslist.append(topicslink);
+ topicslist.append(topicsul);
+ narrowmenu.append(topicslist);
+
+ // Examples
+ var examplestext = $("#examples h2").attr("title");
+ $("#examples ul").removeAttr("id");
+ $("#examples ul li").removeAttr("class");
+ $("#examples ul li").removeAttr("style");
+ var examplesul = $("#examples ul");
+ var exampleslist = $('<li></li>');
+ var exampleslink = $('<a href="#"></a>');
+ exampleslink.append(examplestext);
+ exampleslist.append(exampleslink);
+ exampleslist.append(examplesul);
+ narrowmenu.append(exampleslist);
+
+ $("#shortCut").after(narrowmenu);
+ $('ul#narrowmenu').superfish({
+ delay: 100,
+ autoArrows: false,
+ disableHI: true
+ });
+}
+
+$(document).ready(function(){
+ if ($('body').hasClass('narrow')) {
+ narrowInit();
+ }
+});
+
+$(window).bind('resize', function () {
+ if($(window).width()<600) {
+ $('body').addClass('narrow');
+
+ if ($("#narrowsearch").length == 0) {
+ narrowInit();
+ }
+ }
+ else {
+ $('body').removeClass('narrow');
+ }
+}); \ No newline at end of file