From b0792a5c548c600443edbeaa3c4b0612e0eb4045 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Fri, 24 Sep 2010 09:25:26 +0200 Subject: Doc: Implementing new search display --- doc/src/template/scripts/functions.js | 223 ++++++++++++++++------------ tools/qdoc3/test/qt-html-templates.qdocconf | 9 +- 2 files changed, 138 insertions(+), 94 deletions(-) diff --git a/doc/src/template/scripts/functions.js b/doc/src/template/scripts/functions.js index faa4ca4..5bf8323 100755 --- a/doc/src/template/scripts/functions.js +++ b/doc/src/template/scripts/functions.js @@ -1,38 +1,57 @@ +// Removing search results +function hideSearchResults() { + $('#resultdialog').removeClass('active'); + $("#resultlist").removeClass().addClass('all'); + $("#resultlinks").removeClass().addClass('all'); + $("#searchcount").removeClass().addClass('all'); +} +// Closing search result box +$('#resultclose').click(function(e) { + e.preventDefault(); + hideSearchResults(); +}); + +$(document.body).click(function() { +}); + /* START non link areas where cursor should change to pointing hand */ $('.t_button').mouseover(function() { $('.t_button').css('cursor','pointer'); - /*document.getElementById(this.id).style.cursor='pointer';*/ }); /* END non link areas */ +// Font size small $('#smallA').click(function() { - $('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('font-size','smaller'); + $('.mainContent .heading,.mainContent h1, .mainContent h2, .mainContent h3, .mainContent p, .mainContent li, .mainContent table').css('font-size','smaller'); $('.t_button').removeClass('active') $(this).addClass('active') }); +// Font size reset $('#medA').click(function() { - $('.content .heading').css('font','600 16px/1 Arial'); - $('.content h1').css('font','600 18px/1.2 Arial'); - $('.content h2').css('font','600 16px/1.2 Arial'); - $('.content h3').css('font','600 14px/1.2 Arial'); - $('.content p').css('font','13px/20px Verdana'); - $('.content li').css('font','400 13px/1 Verdana'); - $('.content li').css('line-height','14px'); - $('.content .toc li').css('font', 'normal 10px/1.2 Verdana'); - $('.content table').css('font','13px/1.2 Verdana'); - $('.content .heading').css('font','600 16px/1 Arial'); - $('.content .indexboxcont li').css('font','600 13px/1 Verdana'); + $('.mainContent .heading').css('font','600 16px/1 Arial'); + $('.mainContent h1').css('font','600 18px/1.2 Arial'); + $('.mainContent h2').css('font','600 16px/1.2 Arial'); + $('.mainContent h3').css('font','600 14px/1.2 Arial'); + $('.mainContent p').css('font','13px/20px Verdana'); + $('.mainContent li').css('font','400 13px/1 Verdana'); + $('.mainContent li').css('line-height','14px'); + $('.mainContent .toc li').css('font', 'normal 10px/1.2 Verdana'); + $('.mainContent table').css('font','13px/1.2 Verdana'); + $('.mainContent .heading').css('font','600 16px/1 Arial'); + $('.mainContent .indexboxcont li').css('font','600 13px/1 Verdana'); $('.t_button').removeClass('active') $(this).addClass('active') }); +// Font size large $('#bigA').click(function() { - $('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('font-size','large'); - $('.content .heading,.content h1, .content h2, .content h3, .content p, .content li, .content table').css('line-height','25px'); + $('.mainContent .heading,.mainContent h1, .mainContent h2, .mainContent h3, .mainContent p, .mainContent li, .mainContent table').css('font-size','large'); + $('.mainContent .heading,.mainContent h1, .mainContent h2, .mainContent h3, .mainContent p, .mainContent li, .mainContent table').css('line-height','25px'); $('.t_button').removeClass('active') $(this).addClass('active') }); +// Show page content after closing feedback box $('.feedclose').click(function() { $('.bd').show(); $('.hd').show(); @@ -41,6 +60,7 @@ $('.feedclose').click(function() { $('#blurpage').hide(); }); +// Hide page content and show feedback box $('.feedback').click(function() { $('.bd').hide(); $('.hd').hide(); @@ -48,71 +68,93 @@ $('.feedback').click(function() { $('#feedbackBox').show(); $('#blurpage').show(); }); -var lookupCount = 0; -var articleCount = 0; -var exampleCount = 0; -var qturl = ""; // change from "http://doc.qt.nokia.com/4.6/" to 0 so we can have relative links +// Setting URL - in this case relative to root +var qturl = ""; + +// Process data sent back from the server. The data is structured as a XML. +/* +XML structure handled by function processNokiaData() + - container for each page returned + - contains keywords + - contains page title/header content + - contains page URL - URL relative to root + - contains page type - APIPage/Article/Example + +*/ + function processNokiaData(response){ var propertyTags = response.getElementsByTagName('page'); - for (var i=0; i< propertyTags.length; i++) { - var linkStart = "
  • " + propertyTags[i].getElementsByTagName('pageTitle')[0].firstChild.nodeValue + linkEnd; - $('#ul001').append(full_li_element); - $('#ul001 .defaultLink').css('display','none'); - - } - } - - if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'Article'){ - articleCount++; - - 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').append(full_li_element); - $('#ul002 .defaultLink').css('display','none'); - - } - } - if(propertyTags[i].getElementsByTagName('pageType')[0].firstChild.nodeValue == 'Example'){ - exampleCount++; - - - 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').append(full_li_element); - $('#ul003 .defaultLink').css('display','none'); - - } - } - if(i==propertyTags.length){$('#pageType').removeClass('loading');} - - } - if(lookupCount > 0){$('#ul001 .menuAlert').remove();$('#ul001').prepend('
  • Found ' + lookupCount + ' hits
  • ');$('#ul001 li').css('display','block');$('.sidebar .search form input').removeClass('loading');} - if(articleCount > 0){$('#ul002 .menuAlert').remove();$('#ul002').prepend('
  • Found ' + articleCount + ' hits
  • ');$('#ul002 li').css('display','block');} - if(exampleCount > 0){$('#ul003 .menuAlert').remove();$('#ul003').prepend('
  • Found ' + articleCount + ' hits
  • ');$('#ul003 li').css('display','block');} - - if(lookupCount == 0){$('#ul001 .menuAlert').remove();$('#ul001').prepend('
  • Found no result
  • ');$('#ul001 li').css('display','block');$('.sidebar .search form input').removeClass('loading');} - if(articleCount == 0){$('#ul002 .menuAlert').remove();$('#ul002').prepend('
  • Found no result
  • ');$('#ul002 li').css('display','block');} - if(exampleCount == 0){$('#ul003 .menuAlert').remove();$('#ul003').prepend('
  • Found no result
  • ');$('#ul003 li').css('display','block');} - // reset count variables; - lookupCount=0; - articleCount = 0; - exampleCount = 0; + var apiCount = 0; + var articleCount = 0; + var exampleCount = 0; + var full_li_element; + + $('#resultlist li').remove(); + + + for (var i=0; i'; + $('#resultlist').append(full_li_element); + } + } + + if (propertyTags.length > 0) { + $('#resultdialog').addClass('active'); + $('#resultcount').html(propertyTags.length); + $('#apicount').html(apiCount); + $('#articlecount').html(articleCount); + $('#examplecount').html(exampleCount); + } + + // Filtering results in display + $('p#resultlinks a').click(function(e) { + e.preventDefault(); + // Displays API ref pages + if (this.id == "showapiresults") { + $("#resultlist").removeClass().addClass('api'); + $("#resultlinks").removeClass().addClass('api'); + $("#searchcount").removeClass().addClass('api'); + } + // Displays Articles + else if (this.id == "showarticleresults") { + $("#resultlist").removeClass().addClass('article'); + $("#resultlinks").removeClass().addClass('article'); + $("#searchcount").removeClass().addClass('article'); + } + // Displays Examples + if (this.id == "showexampleresults") { + $("#resultlist").removeClass().addClass('example'); + $("#resultlinks").removeClass().addClass('example'); + $("#searchcount").removeClass().addClass('example'); + } + // Displays All + if (this.id == "showallresults") { + $("#resultlist").removeClass().addClass('all'); + $("#resultlinks").removeClass().addClass('all'); + $("#searchcount").removeClass().addClass('all'); + } + }); } + //build regular expression object to find empty string or any number of blank var blankRE=/^\s*$/; function CheckEmptyAndLoadList() @@ -129,27 +171,22 @@ function CheckEmptyAndLoadList() var value = document.getElementById('pageType').value; if((blankRE.test(value)) || (value.length < 3)) { - //empty inputbox - // load default li elements into the ul if empty - // loadAllList(); // replaced + + + $('.defaultLink').css('display','block'); - // $('.liveResult').css('display','none'); + + $('#resultdialog').removeClass('active'); + $('#resultlist li').remove(); }else{ - $('.defaultLink').css('display','none'); + } } -/* -$(window).resize(function(){ -if($(window).width()<400) - $('body').addClass('offline'); -else - $('body').removeClass('offline'); - }); - */ -// Loads on doc ready + +// Loads on doc ready - prepares search $(document).ready(function () { - //alert(pageUrl); - //$('#pageUrl').attr('foo',pageUrl); + + var pageTitle = $('title').html(); var currentString = $('#pageType').val() ; if(currentString.length < 1){ @@ -165,14 +202,14 @@ else $('.searching').remove(); CheckEmptyAndLoadList(); $('.report').remove(); - // debug$('.content').prepend('
  • too short or blank
  • '); // debug + return; } if (this.timer) clearTimeout(this.timer); this.timer = setTimeout(function () { $('#pageType').addClass('loading'); $('.searching').remove(); - $('.list ul').prepend(''); + $.ajax({ contentType: "application/x-www-form-urlencoded", url: 'http://' + location.host + '/nokiasearch/GetDataServlet', @@ -184,7 +221,7 @@ else $('.liveResult').remove(); $('.searching').remove(); $('#pageType').removeClass('loading'); - $('.list ul').prepend(''); + processNokiaData(response); } diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 44aa918..0d6cb8d 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -71,6 +71,13 @@ HTML.postheader = "
    \n" \ "
    \n" \ "
    \n" \ " \n" \ + "
    \n" \ + " Close \n" \ + "

    All | API | Articles | Examples

    \n" \ + "

     results:

    \n" \ + "
      \n" \ + "
    \n" \ + "
    \n" \ "
    \n" \ "
    \n" \ "
    \n" \ @@ -135,7 +142,7 @@ HTML.postpostheader = " \n" \ " \n" \ " \n" \ " \n" \ - "
    \n" + "
    \n" HTML.footer = "" \ "
    \n" \ -- cgit v0.12 From a21b6be2e97b2678111930bc04eaa843b42fa22b Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Tue, 28 Sep 2010 11:39:38 +0200 Subject: Doc: Added lisence header to snippet --- doc/src/snippets/widgetprinting.cpp | 39 +++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/doc/src/snippets/widgetprinting.cpp b/doc/src/snippets/widgetprinting.cpp index b3d5b7c..47839d8 100644 --- a/doc/src/snippets/widgetprinting.cpp +++ b/doc/src/snippets/widgetprinting.cpp @@ -1,3 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ #include -- cgit v0.12 From d462d0af6fd4ad2fa21ab2f5364754fcb1a9af50 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Tue, 28 Sep 2010 11:45:59 +0200 Subject: Doc: fixing bugs in slim-fit style --- doc/src/template/style/narrow.css | 6 +++--- tools/qdoc3/test/qt-html-templates.qdocconf | 31 ----------------------------- 2 files changed, 3 insertions(+), 34 deletions(-) diff --git a/doc/src/template/style/narrow.css b/doc/src/template/style/narrow.css index de5b0a0..00d28b9 100644 --- a/doc/src/template/style/narrow.css +++ b/doc/src/template/style/narrow.css @@ -6,7 +6,7 @@ } .narrow a { - color: #44a51c; + color: #00732f; } .narrow .header, .narrow .header .content, .narrow .footer, .narrow .wrapper { @@ -45,7 +45,7 @@ { width: auto; height: auto; - color: #363534; + color: #00732f; position: static; float: left; margin-left: 25px; @@ -163,7 +163,7 @@ } .narrow .wrap .breadcrumb ul li a { - color: #44a51c; + color: #00732f; } .narrow .wrap .breadcrumb ul li.last a { diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index 44aa918..9609714 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -26,37 +26,6 @@ HTML.postheader = "
    \n" \ " \n" \ " \n" \ "
    \n" \ - " \n" \ "
    \n" \ "
    \n" \ "
    \n" \ -- cgit v0.12 From 5b053a355a6186fdcfa26d3337ad9eaebce00b01 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Tue, 28 Sep 2010 13:15:27 +0200 Subject: Doc: add style to new search results --- doc/src/template/style/style.css | 80 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-) diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 614e296..c172e23 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -528,6 +528,8 @@ height:21px; padding:2px 0 0 5px; width:167px; + _height: 23px; + _width: 169px; } .sidebar .search form input#pageType @@ -645,6 +647,81 @@ .floatingResult:hover{ } + + #resultdialog { + display: none; + position: absolute; + *left: 30px; + _left: 0; + *top: 35px; + _top: 30px; + _zoom: 1; + background-color: #fff; + border: 1px solid #666; + z-index: 4; + margin-top: 5px; + _margin: 0 0 0 -20px; + padding: 10px; + width: 220px; + _width: 196px; + height: 250px; + overflow: auto; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + border-radius: .5em; + -webkit-box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); + -moz-box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); + box-shadow: 0 4px 6px 0 rgba(0,0,0,.2); + } + + #resultdialog.active { + display: block; + } + + #resultdialog #resultclose { + float: right; + } + + #resultdialog p, + #resultdialog ul { + clear: both; + margin: 3px 0; + } + + p#searchcount span { + display: none; + } + + p#searchcount.all span#resultcount, + p#searchcount.api span#apicount, + p#searchcount.article span#articlecount, + p#searchcount.example span#examplecount { + display: inline; + } + + #resultlist li { + display: none; + } + + #resultlist.api li.api, + #resultlist.article li.article, + #resultlist.example li.example, + #resultlist.all li { + display: block; + } + + #resultlinks.api a#showapiresults, + #resultlinks.api a#showapiresults:hover, + #resultlinks.article a#showarticleresults, + #resultlinks.article a#showarticleresults:hover, + #resultlinks.example a#showexampleresults, + #resultlinks.example a#showexampleresults:hover, + #resultlinks.all a#showallresults, + #resultlinks.all a#showallresults:hover { + color: #B0ADAB; + } + + /* end sidebar elements */ /* content elements */ .wrap @@ -1344,7 +1421,8 @@ .creator .wrapper .hd, .creator .wrapper .ft, .creator .sidebar, - .creator .wrap .feedback + .creator .wrap .feedback, + .creator #resultdialog { display:none; } -- cgit v0.12 From 148e78525f76d3d716fd98af2a018cd08da541ab Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Tue, 28 Sep 2010 13:44:19 +0200 Subject: Doc: fixing slim fit style - search box. --- doc/src/template/style/narrow.css | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/src/template/style/narrow.css b/doc/src/template/style/narrow.css index 00d28b9..8e42a0d 100644 --- a/doc/src/template/style/narrow.css +++ b/doc/src/template/style/narrow.css @@ -203,11 +203,7 @@ *border: 1px solid #fff; *height: 17px; _height: 18px; - /* to be fixed */ - display: none; - /* to be fixed */ } - .narrow .indexbox .indexIcon { display: none; } @@ -268,3 +264,6 @@ } /* end narrow mode */ + .creator #narrowsearch, .creator #narrowmenu{ + display:none; + } -- cgit v0.12 From 8c65dc25962e167237c2573979b1dfff88c29326 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Wed, 29 Sep 2010 16:05:51 +0200 Subject: Doc: Implementing new doc search dialog. Removing search results from menus and including them in a floating dialog div element --- doc/src/template/scripts/functions.js | 87 ++++++++++++++++----------- doc/src/template/scripts/narrow.js | 108 ++++++++++++++++++++++++---------- doc/src/template/style/style.css | 45 +++++++------- 3 files changed, 152 insertions(+), 88 deletions(-) diff --git a/doc/src/template/scripts/functions.js b/doc/src/template/scripts/functions.js index 5bf8323..0bb88a8 100755 --- a/doc/src/template/scripts/functions.js +++ b/doc/src/template/scripts/functions.js @@ -1,11 +1,12 @@ // Removing search results function hideSearchResults() { +/* hiding search results as the user clicks on the different categories */ $('#resultdialog').removeClass('active'); $("#resultlist").removeClass().addClass('all'); $("#resultlinks").removeClass().addClass('all'); $("#searchcount").removeClass().addClass('all'); } -// Closing search result box +/* closing the searhc result dialog */ $('#resultclose').click(function(e) { e.preventDefault(); hideSearchResults(); @@ -19,14 +20,14 @@ $('.t_button').mouseover(function() { $('.t_button').css('cursor','pointer'); }); /* END non link areas */ -// Font size small +/* Changing font size to smaller */ $('#smallA').click(function() { $('.mainContent .heading,.mainContent h1, .mainContent h2, .mainContent h3, .mainContent p, .mainContent li, .mainContent table').css('font-size','smaller'); $('.t_button').removeClass('active') $(this).addClass('active') }); -// Font size reset +/* Reset font size */ $('#medA').click(function() { $('.mainContent .heading').css('font','600 16px/1 Arial'); $('.mainContent h1').css('font','600 18px/1.2 Arial'); @@ -42,8 +43,7 @@ $('#medA').click(function() { $('.t_button').removeClass('active') $(this).addClass('active') }); - -// Font size large +/* Changing font size to bigger */ $('#bigA').click(function() { $('.mainContent .heading,.mainContent h1, .mainContent h2, .mainContent h3, .mainContent p, .mainContent li, .mainContent table').css('font-size','large'); $('.mainContent .heading,.mainContent h1, .mainContent h2, .mainContent h3, .mainContent p, .mainContent li, .mainContent table').css('line-height','25px'); @@ -51,7 +51,7 @@ $('#bigA').click(function() { $(this).addClass('active') }); -// Show page content after closing feedback box +/* Show page content after closing feedback box */ $('.feedclose').click(function() { $('.bd').show(); $('.hd').show(); @@ -60,7 +60,7 @@ $('.feedclose').click(function() { $('#blurpage').hide(); }); -// Hide page content and show feedback box +/* Hide page content and show feedback box */ $('.feedback').click(function() { $('.bd').hide(); $('.hd').hide(); @@ -68,9 +68,11 @@ $('.feedback').click(function() { $('#feedbackBox').show(); $('#blurpage').show(); }); -// Setting URL - in this case relative to root +/* Default search URL */ var qturl = ""; +/* The next function handles the response data (in xml) returned by the search engine */ + // Process data sent back from the server. The data is structured as a XML. /* XML structure handled by function processNokiaData() @@ -84,47 +86,62 @@ XML structure handled by function processNokiaData() function processNokiaData(response){ +/* fetch the responce from the server using page as the root element */ var propertyTags = response.getElementsByTagName('page'); - - var apiCount = 0; + /* reset counters */ + var lookupCount = 0; var articleCount = 0; var exampleCount = 0; - var full_li_element; +/* remove any old results */ $('#resultlist li').remove(); + /* running through the elements in the xml structure */ for (var i=0; i'; - $('#resultlist').append(full_li_element); - } + /* adding the URL attribute*/ + full_li_element += propertyTags[i].getElementsByTagName('pageUrl')[j].firstChild.nodeValue; + /* adding the link title and closing the link and list elements */ + full_li_element += '">' + propertyTags[i].getElementsByTagName('pageTitle')[0].firstChild.nodeValue + ''; + /* appending the list element to the #resultlist div*/ + $('#resultlist').append(full_li_element); + } } + /* if the result is not empty */ if (propertyTags.length > 0) { + /* add class name active to show the dialog */ $('#resultdialog').addClass('active'); + /* setting number of hits*/ $('#resultcount').html(propertyTags.length); $('#apicount').html(apiCount); $('#articlecount').html(articleCount); $('#examplecount').html(exampleCount); } + // Filtering results in display $('p#resultlinks a').click(function(e) { e.preventDefault(); @@ -157,8 +174,11 @@ function processNokiaData(response){ //build regular expression object to find empty string or any number of blank var blankRE=/^\s*$/; + + function CheckEmptyAndLoadList() { + /* Start Extracting information for feedback and adding this to the feedback form */ var pageUrl = window.location.href; var pageVal = $('title').html(); $('#feedUrl').remove(); @@ -166,50 +186,52 @@ function CheckEmptyAndLoadList() $('.menuAlert').remove(); $('#feedform').append(''); $('#feedform').append(''); - $('.liveResult').remove(); - $('.defaultLink').css('display','block'); + /* End Extracting information for feedback and adding this to the feedback form */ + + /* extracts search query */ var value = document.getElementById('pageType').value; + /* if the search is less than three chars long remove class names and remove elements from old search*/ if((blankRE.test(value)) || (value.length < 3)) { - - - - $('.defaultLink').css('display','block'); - $('#resultdialog').removeClass('active'); $('#resultlist li').remove(); - }else{ - } } // Loads on doc ready - prepares search $(document).ready(function () { - - + /* fetch page title*/ var pageTitle = $('title').html(); + /* getting content from search box */ var currentString = $('#pageType').val() ; + /* if the search box is not empty run CheckEmptyAndLoadList*/ if(currentString.length < 1){ - $('.defaultLink').css('display','block'); CheckEmptyAndLoadList(); } + /* on key-up in the search box execute the following */ $('#pageType').keyup(function () { + /* extract the search box content */ var searchString = $('#pageType').val() ; + /* if the string is less than three characters */ if ((searchString == null) || (searchString.length < 3)) { + /* remove classes and elements*/ $('#pageType').removeClass('loading'); - $('.liveResult').remove(); $('.searching').remove(); + /* run CheckEmptyAndLoadList */ CheckEmptyAndLoadList(); - $('.report').remove(); + $('.report').remove(); return; } + /* if timer checks out */ if (this.timer) clearTimeout(this.timer); this.timer = setTimeout(function () { + /* add loading image by adding loading class */ $('#pageType').addClass('loading'); $('.searching').remove(); + /* run the actual search */ $.ajax({ contentType: "application/x-www-form-urlencoded", url: 'http://' + location.host + '/nokiasearch/GetDataServlet', @@ -217,8 +239,7 @@ function CheckEmptyAndLoadList() dataType:'xml', type: 'post', success: function (response, textStatus) { - - $('.liveResult').remove(); + /* on success remove loading img */ $('.searching').remove(); $('#pageType').removeClass('loading'); @@ -226,6 +247,6 @@ function CheckEmptyAndLoadList() } }); - }, 500); + }, 500); /* timer set to 500 ms */ }); - }); + }); \ No newline at end of file diff --git a/doc/src/template/scripts/narrow.js b/doc/src/template/scripts/narrow.js index 35c81bf..a5e8b97 100644 --- a/doc/src/template/scripts/narrow.js +++ b/doc/src/template/scripts/narrow.js @@ -1,17 +1,15 @@ +/* This function generates menus and search box in narrow/slim fit mode */ var narrowInit = function() { - /* TODO: - Could probably be more efficient, not hardcoding each element to be created - */ - // 1: Create search form + /* 1: Create search form */ var narrowSearch = $('
    '); var searchform = $("#qtdocsearch"); narrowSearch.append(searchform); $("#qtdocheader .content .qtref").after(narrowSearch); - // 2: Create dropdowns + /* 2: Create dropdowns */ var narrowmenu = $('
      '); - // Lookup + /* Lookup */ var lookuptext = $("#lookup h2").attr("title"); $("#lookup ul").removeAttr("id"); $("#lookup ul li").removeAttr("class"); @@ -24,7 +22,7 @@ var narrowInit = function() { lookuplist.append(lookupul); narrowmenu.append(lookuplist); - // Topics + /* Topics */ var topicstext = $("#topics h2").attr("title"); $("#topics ul").removeAttr("id"); $("#topics ul li").removeAttr("class"); @@ -37,7 +35,7 @@ var narrowInit = function() { topicslist.append(topicsul); narrowmenu.append(topicslist); - // Examples + /* Examples */ var examplestext = $("#examples h2").attr("title"); $("#examples ul").removeAttr("id"); $("#examples ul li").removeAttr("class"); @@ -58,32 +56,78 @@ var narrowInit = function() { }); } +/* Executes on doc ready */ $(document).ready(function(){ -/* if ($('body').hasClass('narrow')) { - narrowInit(); - } - */ - if($(window).width()<600) { - $('body').addClass('narrow'); - - if ($("#narrowsearch").length == 0) { - narrowInit(); - } - } - else { - $('body').removeClass('narrow'); + /* check if body has the narrow class */ + if ($('body').hasClass('narrow')) { + /* run narrowInit */ + narrowInit(); + } + + /* messure window width and add class if it is smaller than 600 px */ + if($(window).width()<600) { + $('body').addClass('narrow'); + /* if the search box contains */ + if ($("#narrowsearch").length == 0) { + /* run narrowInit */ + narrowInit(); + } + } + else { /* if the window is wider than 600 px, narrow is removed */ + $('body').removeClass('narrow'); + if ($("#narrowsearch").length == 0) { + } + } +}); +/* binding resize event to this funciton */ +$(window).bind('resize', function () { + /* if the window is wider than 600 px, narrow class is added */ + if($(window).width()<600) { + $('body').addClass('narrow'); + if ($("#narrowsearch").length == 0) { + narrowInit(); + } + } + else { + /* else we remove the narrow class */ + $('body').removeClass('narrow'); } }); -$(window).bind('resize', function () { - if($(window).width()<600) { - $('body').addClass('narrow'); + $('#narrowsearch').keyup(function () { + /* extract the search box content */ + var searchString = $('#narrowsearch').val(); + /* if the string is less than three characters */ + if ((searchString == null) || (searchString.length < 3)) { + /* remove classes and elements*/ + $('#narrowsearch').removeClass('loading'); + $('.searching').remove(); + /* run CheckEmptyAndLoadList */ + CheckEmptyAndLoadList(); + + $('.report').remove(); + return; + } + /* if timer checks out */ + if (this.timer) clearTimeout(this.timer); + this.timer = setTimeout(function () { + /* add loading image by adding loading class */ + $('#narrowsearch').addClass('loading'); + $('.searching').remove(); - if ($("#narrowsearch").length == 0) { - narrowInit(); - } - } - else { - $('body').removeClass('narrow'); - } -}); \ No newline at end of file + /* run the actual search */ + $.ajax({ + contentType: "application/x-www-form-urlencoded", + url: 'http://' + location.host + '/nokiasearch/GetDataServlet', + data: 'searchString='+searchString, + dataType:'xml', + type: 'post', + success: function (response, textStatus) { + /* on success remove loading img */ + $('.searching').remove(); + $('#narrowsearch').removeClass('loading'); + processNokiaData(response); + } + }); + }, 500); /* timer set to 500 ms */ + }); \ No newline at end of file diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index c172e23..5833266 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -528,8 +528,6 @@ height:21px; padding:2px 0 0 5px; width:167px; - _height: 23px; - _width: 169px; } .sidebar .search form input#pageType @@ -629,25 +627,11 @@ background:url("../images/spinner.gif") no-repeat scroll right center transparent; } -.floatingResult{ - z-index:1; - position:relative; - padding-top:0px; - background-color:white; - border:solid 1px black; - height:250px; - width:600px; - overflow-x:hidden; - overflow-y:auto; -} - - .floatingResult:hover{ - display:block; - } - .floatingResult:hover{ + .sidebar .search form { + _height: 23px; + _width: 169px; } - - + #resultdialog { display: none; position: absolute; @@ -720,7 +704,23 @@ #resultlinks.all a#showallresults:hover { color: #B0ADAB; } - + .floatingResult{ + z-index:1; + position:relative; + padding-top:0px; + background-color:white; + border:solid 1px black; + height:250px; + width:600px; + overflow-x:hidden; + overflow-y:auto; + } + + .floatingResult:hover{ + display:block; + } + .floatingResult:hover{ + } /* end sidebar elements */ /* content elements */ @@ -1421,8 +1421,7 @@ .creator .wrapper .hd, .creator .wrapper .ft, .creator .sidebar, - .creator .wrap .feedback, - .creator #resultdialog + .creator .wrap .feedback { display:none; } -- cgit v0.12 From dc4d4a87c0c17e41c0e16bc481db82de0f620596 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Fri, 1 Oct 2010 14:26:49 +0200 Subject: Doc: Implementing features to the search feature. Adding search to narrow/slim fit mode --- doc/src/template/scripts/functions.js | 2 +- doc/src/template/style/narrow.css | 1 + doc/src/template/style/style.css | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/src/template/scripts/functions.js b/doc/src/template/scripts/functions.js index 0bb88a8..b89e05f 100755 --- a/doc/src/template/scripts/functions.js +++ b/doc/src/template/scripts/functions.js @@ -89,7 +89,7 @@ function processNokiaData(response){ /* fetch the responce from the server using page as the root element */ var propertyTags = response.getElementsByTagName('page'); /* reset counters */ - var lookupCount = 0; + var apiCount = 0; var articleCount = 0; var exampleCount = 0; var full_li_element; diff --git a/doc/src/template/style/narrow.css b/doc/src/template/style/narrow.css index 8e42a0d..c1e3f61 100644 --- a/doc/src/template/style/narrow.css +++ b/doc/src/template/style/narrow.css @@ -61,6 +61,7 @@ { background-image: none; text-indent: 0; + width: 260px; } .narrow .header #nav-topright diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 5833266..c07385c 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -204,6 +204,10 @@ { font-size: 13px; } + .red + { + color:red; + } /* end font style elements */ /* global settings*/ @@ -907,7 +911,6 @@ .wrap .content table p { line-height: 20px; - /* padding: 0px;*/ } .wrap .content ul { -- cgit v0.12 From 628c9625c4bf6d0e189f9e8da5268eb7629e7597 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Fri, 1 Oct 2010 14:56:00 +0200 Subject: Doc: Fixing link titles and error color in search results --- doc/src/template/scripts/functions.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/src/template/scripts/functions.js b/doc/src/template/scripts/functions.js index b89e05f..47539d2 100755 --- a/doc/src/template/scripts/functions.js +++ b/doc/src/template/scripts/functions.js @@ -124,7 +124,7 @@ function processNokiaData(response){ /* adding the URL attribute*/ full_li_element += propertyTags[i].getElementsByTagName('pageUrl')[j].firstChild.nodeValue; /* adding the link title and closing the link and list elements */ - full_li_element += '">' + propertyTags[i].getElementsByTagName('pageTitle')[0].firstChild.nodeValue + ''; + full_li_element += '">' + propertyTags[i].getElementsByTagName('pageWords')[0].firstChild.nodeValue + ''; /* appending the list element to the #resultlist div*/ $('#resultlist').append(full_li_element); } @@ -139,7 +139,12 @@ function processNokiaData(response){ $('#apicount').html(apiCount); $('#articlecount').html(articleCount); $('#examplecount').html(exampleCount); - } + + } + else { + $('#pageType').addClass('red'); + } + // Filtering results in display @@ -181,6 +186,7 @@ function CheckEmptyAndLoadList() /* Start Extracting information for feedback and adding this to the feedback form */ var pageUrl = window.location.href; var pageVal = $('title').html(); + $('#pageType').removeClass('red'); $('#feedUrl').remove(); $('#pageVal').remove(); $('.menuAlert').remove(); -- cgit v0.12