# HG changeset patch # User ivanl # Date 1244720418 -3600 # Node ID cb63681127272e3edadfabf6206ce7f885bdf47b # Parent 9cbe91927e8929c96fac9663c9300c0e22bf920e 1.0rc8 - Fixed HTML cleaning function which inherited a bug from example code. The bug prevents rendering of feed entries that contain greater than and less than signs. diff -r 9cbe91927e89 -r cb6368112727 Symbian.org/FeedUpdateBroker.js --- a/Symbian.org/FeedUpdateBroker.js Tue Jun 09 13:59:04 2009 +0100 +++ b/Symbian.org/FeedUpdateBroker.js Thu Jun 11 12:40:18 2009 +0100 @@ -166,7 +166,7 @@ if (buf != "") { buf += " "; } - buf += child.nodeValue; + buf += escapeLtGt(child.nodeValue); } child = child.nextSibling; } @@ -175,7 +175,8 @@ var strippedBuf = ""; var textStartPos = -1; var tagBalance = 0; - + + var pos; // iterate through the text and append all text to the stripped buffer // that is at a tag balance of 0 for (pos = 0; pos < buf.length; pos++) { @@ -210,3 +211,9 @@ this.cancelled = true; this.httpReq.abort(); } + +function escapeLtGt(text){ + var lt = "<"; + var gt = ">"; + return text.replace(//g, gt); +} diff -r 9cbe91927e89 -r cb6368112727 Symbian.org/Forums.js --- a/Symbian.org/Forums.js Tue Jun 09 13:59:04 2009 +0100 +++ b/Symbian.org/Forums.js Thu Jun 11 12:40:18 2009 +0100 @@ -332,7 +332,7 @@ // initialize feed item control var title = item.title; - if ( title.length == 0 ) { + if ( !title || title.length == 0 ) { title = "Re:"; item.title = title; } @@ -410,12 +410,6 @@ // Utilities -// feeds contain bbcodes - this function should turn the bbcode markup -// to HTML -function bbcode2html(s) { - return sanitize(s); -} - // Forum posts can be be quite messy and include bbcodes, smilies etc. // This function does the minimum by stripping bbcodes and such function sanitize(text) { @@ -441,3 +435,59 @@ +// feeds contain bbcodes - this function should turn the bbcode markup +// to HTML +function bbcode2html(s) { + var prevind = 0; + var buf = ""; + var ind = s.indexOf("["); + if ( ind == -1 ) return s; + while ( ind != -1 ) { + buf += s.substring(prevind, ind); + var ind2 = s.indexOf("]", ind); // end of tag + var fulltag = s.substring(ind+1,ind2); + var tag = fulltag; + var ind3 = s.indexOf("=", ind); // end of tag name, eg. [URL=http...] + if ( ind3 != -1 && ind3 < ind2) { + tag = s.substring(ind+1,ind3); + } + var ind4 = s.indexOf("[/"+tag+"]"); + var tagContent = s.substring(ind2+1, ind4); + buf += convertTag(tag, fulltag, tagContent); + if ( ind4 != -1 ) { + prevind = s.indexOf(']',ind4) + 1; + } else { + break; + } + ind = s.indexOf("[", prevind); + } + buf += s.substring(prevind); + return buf; +} + +function convertTag(tag, fulltag, tagContent) { + tag = tag.toLowerCase(); + switch(tag) { + case 'b':case 'i':case 'u':case 's':case 'sup':case 'sub':case 'h1':case 'h2':case 'h3':case 'h4':case 'h5':case 'h6':case 'table':case 'tr':case 'th':case 'td': + { + return '<' + tag + '>' + tagContent + ""; + } + case 'quote': return '
' + tagContent + '
'; + case 'url': { + var eqsign = fulltag.indexOf("="); + if ( eqsign > -1 ) { + return ''; + } else { + return ''; + } + } + } +} diff -r 9cbe91927e89 -r cb6368112727 Symbian.org/Main.js --- a/Symbian.org/Main.js Tue Jun 09 13:59:04 2009 +0100 +++ b/Symbian.org/Main.js Thu Jun 11 12:40:18 2009 +0100 @@ -46,7 +46,7 @@ var wikiBaseUrl = symbianOrgBaseUrl+"/wiki/index.php"; // Update variables -var myversion = "1.0rc6"; +var myversion = "1.0rc8"; var versionWikiPageUrl = wikiBaseUrl + "/Symbian.org_WRT_Widget"; var versionWikiPageString = "Current widget version is ["; var downloadUrl = symbianOrgBaseUrl + "/wiki/images/c/c5/Symbian.org.wgz"; diff -r 9cbe91927e89 -r cb6368112727 Symbian.org/wrt_preview_frame.html --- a/Symbian.org/wrt_preview_frame.html Tue Jun 09 13:59:04 2009 +0100 +++ b/Symbian.org/wrt_preview_frame.html Thu Jun 11 12:40:18 2009 +0100 @@ -1,85 +1,216 @@ - -Nokia WRT Preview - - - - + + Nokia WRT Preview + + + + + + + + + -
-
- - - - - - - - - -
Select Device
-
Device

Model:
- Nokia 5320 XpressMusic

-

Resolution:
- 240 x 320 pixels

Developer Platform:
- S60 3rd Edition, Feature Pack 2

-

Display Orientation:
- - -

+
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+
+
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + +
+ Resolution + +   Device matrix featuring this resolution +
+ Orientation + +
+ + +
+
+
+
+ WRT Version + + + +
+ Home Screen view + +
+ Hello +
+
+
+ +
+
+ Back +
+ + + + + + + +
To enable Mini view support for HomeScreen widget
+ Add this line in Info.plist file + <key>MiniViewEnabled</key>
<true/>
+ and optionally add the following to the MainHTML file + <div id="miniView"> <-- Define your Home Screen view here --> </div>
+ See Web Developer's Library for more details +
+
+ + +
+
+ +
+
+
+
+
+ +
+
+ Back +
+ + + + + + + + + + + + +
Battery Triggers
Charging status + Connect charger + Disconnect charger +
Battery Strength +
+
0
+ +
+
+ +
+
+ Back +
+ + + + + + + + +
Message Triggers
New message + Trigger new SMS + Trigger new MMS +
+
+ +
+
+ Back +
+ + + + + + + + +
Memory Triggers
Memory Card + Connect + Disconnect +
+
+ +
+
-
-
-
-
- - - - - - - -
-
-
-
- - -
-
-
-
-
- - - - - - -
 
-
-
-
-
+
+
+
+
Console window
+ + +
+
+
+
+
+
+
+
+
+

NOKIA WRT Simulation may not work properly on this browser,
Firefox is recommended for widget preview and debugging.

Continue?

+
+
+

NOKIA WRT Simulation may not work properly on this browser, Firefox is recommended for widget preview and debugging

+