updates and additions
[webos-internals:modifications.git] / youtube / youtube-hyperlinks-in-descripts.patch
1 diff --git a/usr/palm/applications/com.palm.app.youtube/app/controllers/video-assistant.js b/usr/palm/applications/com.palm.app.youtube/app/controllers/video-assistant.js
2 index 5c3be25..f3c1978 100644
3 --- a/usr/palm/applications/com.palm.app.youtube/app/controllers/video-assistant.js
4 +++ b/usr/palm/applications/com.palm.app.youtube/app/controllers/video-assistant.js
5 @@ -21,6 +21,24 @@ var VideoAssistant = Class.create({
6                 this.controller.setupWidget('share-menu', undefined, this.shareMenuModel);
7                 this.controller.setupWidget(Mojo.Menu.commandMenu, {menuClass: "no-fade"}, this.cmdMenuModel);
8                 
9 +               var s1 = this.video.desc.split("\n");
10 +               this.video.desc = "";
11 +               for(var i=0; i<s1.length; i++) {
12 +                       var s2 = s1[i].split(" ");
13 +                       for(var j=0; j<s2.length; j++) {
14 +                               if(s2[j].indexOf("http://")==0 || s2[j].indexOf("www.")==0) {
15 +                                       this.video.desc += "<a href=\"" + s2[j] + "\">" + s2[j] + "</a>";
16 +                               } else {
17 +                                       this.video.desc += s2[j];
18 +                               }
19 +                               if(j!=s2.length-1) {
20 +                                       this.video.desc += " ";
21 +                               }
22 +                       }
23 +                       if(i!=s1.length-1) {
24 +                               this.video.desc += "<br>";
25 +                       }
26 +               }
27                 // render video details template
28          var info = Mojo.View.render({object: this.video, template: 'video/video-info'});
29          $('video_info').update(info);
30 diff --git a/usr/palm/applications/com.palm.app.youtube/app/views/video/video-info.html b/usr/palm/applications/com.palm.app.youtube/app/views/video/video-info.html
31 index c2f1d9c..f33a4dc 100644
32 --- a/usr/palm/applications/com.palm.app.youtube/app/views/video/video-info.html
33 +++ b/usr/palm/applications/com.palm.app.youtube/app/views/video/video-info.html
34 @@ -14,5 +14,5 @@
35         <div id="videoName" class="video-name">#{title}</div>
36  
37         <div id="author" class="video-author">#{author}</div>
38 -       <div id="desc_preview" class="video-description">#{desc}</div>          
39 +       <div id="desc_preview" class="video-description">#{-desc}</div>
40  </div>
41 \ No newline at end of file