From 7770690dc220c4e75ed1411d2adf2e819092f7f2 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 6 May 2010 15:52:07 +0200 Subject: Doc: updating html and search feature Doc: implementing the search feature in the online docs Reviewed-by: Morten Engvoldsen --- doc/src/template/scripts/functions.js | 279 +++++++++------------------------- doc/src/template/style/style.css | 31 ++-- tools/qdoc3/htmlgenerator.cpp | 28 +--- 3 files changed, 90 insertions(+), 248 deletions(-) diff --git a/doc/src/template/scripts/functions.js b/doc/src/template/scripts/functions.js index 800660e..4b3107f 100755 --- a/doc/src/template/scripts/functions.js +++ b/doc/src/template/scripts/functions.js @@ -3,7 +3,6 @@ $('.t_button').mouseover(function() { $('.t_button').css('cursor','pointer'); /*document.getElementById(this.id).style.cursor='pointer';*/ }); - /* END non link areas */ $('#smallA').click(function() { $('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('font-size','smaller'); @@ -38,120 +37,62 @@ $('#bigA').click(function() { var lookupCount = 0; var articleCount = 0; var exampleCount = 0; -var qturl = ""; // change to 0 +var qturl = ""; // change from "http://doc.qt.nokia.com/4.6/" to 0 so we can have relative links + function processNokiaData(response){ + // debug $('.content').prepend('
  • handling search results
  • '); // debuging var propertyTags = response.getElementsByTagName('page'); - var ulStartElement = ""; - - for (var i=0; i< propertyTags.length; i++) { + + for (var i=0; i< propertyTags.length; i++) { + var linkStart = "
  • " + propertyTags[i].getElementsByTagName('pageTitle')[0].firstChild.nodeValue - + '
  • ' ; - -// $('#list002 li').remove(); -// $('#tbl002').prepend('
  • foo1
  • '); -// $('#tbl002').prepend('
  • bar2
  • '); - - $('ul001').prepend(full_address_lookup); + if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'APIPage'){ + lookupCount=0; + //$('.live001').css('display','block'); + + for (var j=0; j< propertyTags[i].getElementsByTagName('pageWords').length; j++){ + full_li_element = linkStart + propertyTags[i].getElementsByTagName('pageUrl')[j].firstChild.nodeValue; + full_li_element = full_li_element + "'>" + propertyTags[i].getElementsByTagName('pageTitle')[0].firstChild.nodeValue + linkEnd; + $('#ul001').prepend(full_li_element); } } - - if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'Article'){ - articleCount = 0; - document.getElementById('live002').style.display = "block"; - for (var j=0; j< propertyTags[i].getElementsByTagName('pageWords').length; j++){ - full_address_topic = full_address_topic + propertyTags[i].getElementsByTagName('pageUrl')[j].firstChild.nodeValue; - full_address_topic = full_address_topic + "'>" + propertyTags[i].getElementsByTagName('pageTitle')[0].firstChild.nodeValue - + ''; + + if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'Article'){ + articleCount = 0; + //$('.live002').css('display','block'); + + for (var j=0; j< propertyTags[i].getElementsByTagName('pageWords').length; j++){ + full_li_element = linkStart + propertyTags[i].getElementsByTagName('pageUrl')[j].firstChild.nodeValue; + full_li_element =full_li_element + "'>" + propertyTags[i].getElementsByTagName('pageTitle')[0].firstChild.nodeValue + linkEnd ; - $('ul002').prepend(full_address_lookup); - } - } - if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'Example'){ - exampleCount = 0; - document.getElementById('live003').style.display = "block"; - - for (var j=0; j< propertyTags[i].getElementsByTagName('pageWords').length; j++){ - full_address_examples = full_address_examples + propertyTags[i].getElementsByTagName('pageUrl')[j].firstChild.nodeValue; - full_address_examples = full_address_examples + "'>" + propertyTags[i].getElementsByTagName('pageTitle')[0].firstChild.nodeValue - + ''; + $('#ul002').prepend(full_li_element); + } + } + if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'Example'){ + exampleCount = 0; + //$('.live003').css('display','block'); + + for (var j=0; j< propertyTags[i].getElementsByTagName('pageWords').length; j++){ + full_li_element = linkStart + propertyTags[i].getElementsByTagName('pageUrl')[j].firstChild.nodeValue; + full_li_element =full_li_element + "'>" + propertyTags[i].getElementsByTagName('pageTitle')[0].firstChild.nodeValue + linkEnd ; - $('ul003').prepend(full_address_lookup); - } - } - + $('#ul003').prepend(full_li_element); + } + } } - - - if(lookupCount == 0){loadLookupList();} - if(articleCount == 0){loadArticleList();} - if(exampleCount == 0){loadExampleList();} + if(lookupCount == 0){$('#ul001').prepend('
  • no result
  • ');$('#ul001 li').css('display','block');} + if(articleCount == 0){$('#ul002').prepend('
  • no result
  • ');$('#ul002 li').css('display','block');} + if(exampleCount == 0){$('#ul003').prepend('
  • no result
  • ');$('#ul003 li').css('display','block');} // reset count variables; lookupCount=0; articleCount = 0; exampleCount = 0; } -function removeResults() { - -// get hold of the non-default li elements and delete them - $('.live li').remove(); - - - /* var resultsTableLookup = document.getElementById('div001'); - var recordslookup = resultsTableLookup.rows.length; - - for (var i=(recordslookup-1); i> 0; i--){ - // resultsTableLookup.deleteRow(i); - - } - - var resultsTableTopic = document.getElementById('div002'); - var recordstopic = resultsTableTopic.rows.length; - for (var i=(recordstopic-1); i> 0; i--){ - // alert("delete: " + i); - // resultsTableTopic.deleteRow(i); - } - - var resultsTableexample = document.getElementById('div003'); - var recordsexample = resultsTableexample.rows.length; - for (var i=(recordsexample-1); i> 0; i--) - // resultsTableexample.deleteRow(i); - - removeList(); */ -} - -function removeList(){ - // var resultsTableLookuplist = document.getElementById('ul001'); - // var recordlookuplist = resultsTableLookuplist.rows.length; - // for (var i=(recordlookuplist-1); i> 0; i--) - // resultsTableLookuplist.deleteRow(i); - - // var resultsTableArticlelist = document.getElementById('ul002'); - // var recordArticlelist = resultsTableArticlelist.rows.length; - // for (var i=(recordArticlelist-1); i> 0; i--) - // resultsTableArticlelist.deleteRow(i); - - // var resultsTableExamplelist = document.getElementById('ul003'); - // var recordExamplelist = resultsTableExamplelist.rows.length; - // for (var i=(recordExamplelist-1); i> 0; i--) - // resultsTableExamplelist.deleteRow(i); - } - //build regular expression object to find empty string or any number of blank var blankRE=/^\s*$/; function CheckEmptyAndLoadList() @@ -161,114 +102,44 @@ function CheckEmptyAndLoadList() { //empty inputbox // load default li elements into the ul if empty - loadAllList(); - //alert("loadAllList"); - document.getElementById('live001').style.display = "none"; - document.getElementById('live002').style.display = "none"; - document.getElementById('live003').style.display = "none"; - document.getElementById('list001').style.display = "block"; - document.getElementById('list002').style.display = "block"; - document.getElementById('list003').style.display = "block"; + // loadAllList(); // replaced + $('.defaultLink').css('display','block'); + // $('.liveResult').css('display','none'); }else{ - removeList(); - //alert("removeList"); - document.getElementById('live001').style.display = "block"; - document.getElementById('live002').style.display = "block"; - document.getElementById('live003').style.display = "block"; - - } -} -function loadAllList(){ - - /*var fullAddressListLookup = ""; - // var rowlistlookup = document.getElementById('ul001').insertRow(-1); - // var celllistlookup = rowlistlookup.insertCell(-1); - // celllistlookup.style.padding="0 0 0 0"; - //celllistlookup.style.width="10px"; - //celllistlookup.style.background = "yellow"; - //celllistlookup.innerHTML = fullAddressListLookup ; - - - - - var fullAddressListArticle = ""; - // var rowlistarticle = document.getElementById('ul002').insertRow(-1); - // var celllistarticle = rowlistarticle.insertCell(-1); - // celllistarticle.style.padding="0 0 0 0"; - //celllistarticle.innerHTML = fullAddressListArticle ; - - - var fullAddressListExample = ""; - // var rowlistexample = document.getElementById('ul003').insertRow(-1); - // var celllistexample = rowlistexample.insertCell(-1); - // celllistexample.style.padding="0 0 0 0"; - //celllistexample.innerHTML = fullAddressListExample ;*/ - -} - -function loadLookupList(){ - - /*var fullAddressListLookup = ""; - // var rowlistlookup = document.getElementById('ul001').insertRow(-1); - // var celllistlookup = rowlistlookup.insertCell(-1); - // celllistlookup.style.padding="0 0 0 0"; - //celllistlookup.style.width="10px"; - //celllistlookup.style.background = "yellow"; - celllistlookup.innerHTML = fullAddressListLookup ; - document.getElementById('live001').style.display = "none"; - document.getElementById('list001').style.display = "block"; - //alert("loadLookupList") -*/ -} -function loadArticleList(){ - /* - var fullAddressListArticle = ""; - // var rowlistarticle = document.getElementById('ul002').insertRow(-1); - // var celllistarticle = rowlistarticle.insertCell(-1); - // celllistarticle.style.padding="0 0 0 0"; - celllistarticle.innerHTML = fullAddressListArticle ; - document.getElementById('live002').style.display = "none"; - document.getElementById('list002').style.display = "block";*/ + $('.defaultLink').css('display','none'); } - -function loadExampleList(){ - /* - var fullAddressListExample = ""; - // var rowlistexample = document.getElementById('ul003').insertRow(-1); - // var celllistexample = rowlistexample.insertCell(-1); - // celllistexample.style.padding="0 0 0 0"; - celllistexample.innerHTML = fullAddressListExample ; - document.getElementById('live003').style.display = "none"; - document.getElementById('list003').style.display = "block";*/ - } +// Loads on doc ready + $(document).ready(function () { + $('#pageType').keyup(function () { + var searchString = $('#pageType').val() ; + if ((searchString == null) || (searchString.length < 3)) { + $('.liveResult').remove(); // replaces removeResults(); + CheckEmptyAndLoadList(); + $('.report').remove(); + // debug$('.content').prepend('
  • too short or blank
  • '); // debug + return; + } + if (this.timer) clearTimeout(this.timer); + this.timer = setTimeout(function () { + // debug$('.content').prepend('
  • new search started
  • ');// debug + // debug$('.content').prepend('

    Search string ' +searchString +'

    '); // debug + + $.ajax({ + contentType: "application/x-www-form-urlencoded", + url: 'http://' + location.host + '/nokiasearch/GetDataServlet', + data: 'searchString='+searchString, + dataType:'xml', + type: 'post', + success: function (response, textStatus) { + + $('.liveResult').remove(); // replaces removeResults(); + processNokiaData(response); + + } + }); + }, 500); + }); + }); diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 220afb9..6bcb0db 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -1020,6 +1020,11 @@ overflow:hidden; } + +.indexboxcont .section { + float: left; +} + .indexboxcont .section p { padding-top: 20px; @@ -1028,7 +1033,7 @@ .indexboxcont .sectionlist { display: inline-block; - width: 33%; + width: 32.5%; padding: 0; } .indexboxcont .sectionlist ul @@ -1057,6 +1062,12 @@ color: #00732f; text-decoration: none; } + + .indexbox .indexIcon { + width: 11%; + } + + .indexbox .indexIcon span { display: block; @@ -1085,25 +1096,11 @@ clear: both; visibility: hidden; } - /* - - + - .lastcol - { - display: inline-block; - vertical-align: top; - padding: 0; - max-width: 25%; - } + /* end of screen media */ - .tricol .lastcol - { - margin-left: -6px; - } - */ - /* end indexbox */ } /* end of screen media */ diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index dfba368..93b0218 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1795,32 +1795,7 @@ void HtmlGenerator::generateHeader(const QString& title, //out() << " Qt Reference Documentation"; out() << " \n"; out() << " \n"; - out() << " \n"; + out() << " \n"; out() << "\n"; if (offlineDocs) @@ -1868,7 +1843,6 @@ void HtmlGenerator::generateFooter(const Node *node) out() << QString(footer).replace("\\" + COMMAND_VERSION, myTree->version()) << QString(address).replace("\\" + COMMAND_VERSION, myTree->version()); - out() << " \n"; out() << "\n"; out() << "\n"; } -- cgit v0.12