linterna-magica-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linterna-magica-commit] [119] Changes for tasks #11216.


From: Ivaylo Valkov
Subject: [linterna-magica-commit] [119] Changes for tasks #11216.
Date: Thu, 07 Jul 2011 13:41:42 +0000

Revision: 119
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=119
Author:   valkov
Date:     2011-07-07 13:41:41 +0000 (Thu, 07 Jul 2011)
Log Message:
-----------
Changes for tasks #11216. There is no need to add site specific rule to wait 
before xhr requests. Made the XHR waitingcode (Dailymotion) general porpose. 
Changed the helper script for separate config.

Ticket Links:
------------
    http://savannah.gnu.org/task/?11216

Modified Paths:
--------------
    branches/task-11216/HELP
    branches/task-11216/HELP.bg
    branches/task-11216/src/lm_config_options.js
    branches/task-11216/src/lm_constructors.js
    branches/task-11216/src/lm_extract_dom_objects.js
    branches/task-11216/src/lm_init_options.js
    branches/task-11216/src/lm_sites.js
    branches/task-11216/utilities/linternamagica_user_config.user.js

Modified: branches/task-11216/HELP
===================================================================
--- branches/task-11216/HELP    2011-07-07 11:55:54 UTC (rev 118)
+++ branches/task-11216/HELP    2011-07-07 13:41:41 UTC (rev 119)
@@ -16,7 +16,7 @@
     "controls": "self",
     "locale": "auto",
     "cookies": "restore",
-    "wait_dm": "off",
+    "wait_xhr": "off",
     "quality": "low",
  };
 
@@ -95,8 +95,8 @@
            Just delete the cookies.
         restore
            Extract and restore cookies.
-  wait_dm
-      Timeout before background processing starts in Dailymotion in
+  wait_xhr
+      Timeout before background processing (XHR) starts in
       milliseconds. 1 s = 1000 ms. If you have problems increase the
       value.
         off/no/disabled/false/0
@@ -137,13 +137,16 @@
 automatically set new values to some of the cookies with the
 background request. 
 
-For Dailymotion there is a timeout option. During the first tests of
-this fix there were some problems if the background request was made
-too soon. It seemed that not all cookies were set by the site and
-cleared by Linterna Mágica before the request. Later everything worked
-without timeout. If you have problems with Dailymotion increase the
-value for the "wait_dm" option.
+For Dailymotion you could use a timeout option. During the first
+tests of this fix there were some problems if the background request
+was made too soon. It seemed that not all cookies were set by the site
+and cleared by Linterna Mágica before the request. Later everything
+worked without timeout. If you have problems with Dailymotion increase
+the value for the "wait_xhr" option. 
 
+The wait_xhr option is effective for every site that is supported with
+background requests.
+
 Localisation
 
 Since version 0.0.10 the translations are split from the main

Modified: branches/task-11216/HELP.bg
===================================================================
--- branches/task-11216/HELP.bg 2011-07-07 11:55:54 UTC (rev 118)
+++ branches/task-11216/HELP.bg 2011-07-07 13:41:41 UTC (rev 119)
@@ -15,7 +15,7 @@
     "controls": "self",
     "locale": "auto",
     "cookies": "restore",
-    "wait_dm": "off",
+    "wait_xhr": "off",
     "quality": "low",
  };
 
@@ -96,9 +96,9 @@
            Бисквитките ще бъдат изтрити.
         restore
            Извличане и възстановяване на бисквитки.
-  wait_dm
-      Време за изчакване преди да започне обработката на заден план за
-      Dailymotion в милисекунди. 1 s = 1000 ms. В случай на проблеми
+  wait_xhr
+      Време за изчакване преди да започне обработката на заден план
+      (XHR) в милисекунди. 1 s = 1000 ms. В случай на проблеми
       увеличете стойността.
         off/no/disabled/false/0
            Да не се изчаква (стандартно)
@@ -148,8 +148,11 @@
 от страницата не се записваха всички бисквитки и съответно не се
 изчистваха от Linterna Mágica преди заявката. По-късно решението
 работеше без изчакване. Ако имате проблеми с Dailymotion, увеличете
-стойността на "wait_dm".
+стойността на "wait_xhr".
 
+Настройката wait_xhr важи за всяка страница, която се поддържа чрез
+заявки на заден план.
+
 Превод на интерфейса
 
 От версия 0.0.10 нататък преводите са разделени от основния

Modified: branches/task-11216/src/lm_config_options.js
===================================================================
--- branches/task-11216/src/lm_config_options.js        2011-07-07 11:55:54 UTC 
(rev 118)
+++ branches/task-11216/src/lm_config_options.js        2011-07-07 13:41:41 UTC 
(rev 119)
@@ -132,7 +132,7 @@
 
 // Set the timeout for Dailymotion. After this timeout background
 // processing starts
-LinternaMagica.prototype.set_wait_dailymotion = function(wait)
+LinternaMagica.prototype.set_wait_xhr = function(wait)
 {
     var set_wait_to = wait ? wait :"";
 
@@ -156,7 +156,12 @@
        set_wait_to = 0;
     }
 
-    this.wait_dailymotion = set_wait_to;
+    if (/[0-9]+/i.test(wait))
+    {
+       set_wait_to = parseInt(wait);
+    }
+
+    this.wait_xhr = set_wait_to;
 }
 
 // Set updates 

Modified: branches/task-11216/src/lm_constructors.js
===================================================================
--- branches/task-11216/src/lm_constructors.js  2011-07-07 11:55:54 UTC (rev 
118)
+++ branches/task-11216/src/lm_constructors.js  2011-07-07 13:41:41 UTC (rev 
119)
@@ -96,7 +96,7 @@
     this.set_autostart(params.autostart);
     this.set_controls(params.controls);
     this.set_cookies(params.cookies);
-    this.set_wait_dailymotion(params.wait_dm);
+    this.set_wait_xhr(params.wait_xhr);
     this.set_check_updates(params.updates);
     this.set_hd_link_quality(params.quality);
 

Modified: branches/task-11216/src/lm_extract_dom_objects.js
===================================================================
--- branches/task-11216/src/lm_extract_dom_objects.js   2011-07-07 11:55:54 UTC 
(rev 118)
+++ branches/task-11216/src/lm_extract_dom_objects.js   2011-07-07 13:41:41 UTC 
(rev 119)
@@ -235,21 +235,7 @@
            }
            else if (object_data.video_id)
            {
-               this.log("LinternaMagica.extract_objects_from_dom:\n"+
-                        "Requesting video link via video_id "+
-                        object_data.video_id,1);
-
-               // Wait a while for Dailymotion At the beginning it
-               // seemed that cookies are not set for few seconds.
-               if (/dailymotion\.com/i.test(window.location.hostname))
-               {
-                   var data = object_data;
-                   var self = this;
-                   setTimeout(function() {
-                       self.request_video_link.apply(self,[data]);
-                   }, this.wait_dailymotion);
-               }
-               else if (!/blip\.tv/i.test(window.location.hostname) &&
+               if (!/blip\.tv/i.test(window.location.hostname) &&
                         ((object.hasAttribute('src') &&
                          /blip\.tv/i.test(object.getAttribute('src'))) ||
                         (object.hasAttribute('data') && 
@@ -257,8 +243,25 @@
                {
                    this.request_bliptv_jsonp_data(object_data);
                }
+               else if (this.wait_xhr)
+               {
+                   this.log("LinternaMagica.extract_objects_from_dom:\n"+
+                            "Waiting "+this.wait_xhr+
+                            " ms ("+(this.wait_xhr/1000)+
+                            " s) before requesting video link via"+
+                            " video_id "+object_data.video_id+" ",1);
+
+                   var self = this;
+                   var data = object_data;
+                   setTimeout(function() {
+                       self.request_video_link.apply(self,[data]);
+                   }, this.wait_xhr);
+               }
                else
                {
+                   this.log("LinternaMagica.extract_objects_from_dom:\n"+
+                            "Requesting video link via video_id "+
+                            object_data.video_id,1);
                    this.request_video_link(object_data);
                }
            }

Modified: branches/task-11216/src/lm_init_options.js
===================================================================
--- branches/task-11216/src/lm_init_options.js  2011-07-07 11:55:54 UTC (rev 
118)
+++ branches/task-11216/src/lm_init_options.js  2011-07-07 13:41:41 UTC (rev 
119)
@@ -75,12 +75,12 @@
        // delete: Just delete the cookies.
        // restore: Extract and restore cookies.
        "cookies": "restore",
-       // Timeout before background processing starts in Dailymotion in
+       // Timeout before background processing (XHR) starts  in
        // milliseconds. 1 s = 1000 ms. If you have problems increase the
        // value.
        // off/no/disabled/false/0: Don't wait (defult)
         // <integer>: Wait for <integer> milliseconds.
-       "wait_dm": "off",
+       "wait_xhr": "off",
        // Preferred video quality.
        //
        // low/medium/high: Automatically select the link for

Modified: branches/task-11216/src/lm_sites.js
===================================================================
--- branches/task-11216/src/lm_sites.js 2011-07-07 11:55:54 UTC (rev 118)
+++ branches/task-11216/src/lm_sites.js 2011-07-07 13:41:41 UTC (rev 119)
@@ -107,7 +107,6 @@
     return true;
 }
 
-// LinternaMagica.prototype.sites.__wait_before_xhr
 // LinternaMagica.prototype.sites.__extract_scripts_extract_when // Condition 
? DM /ted? 
 // LinternaMagica.prototype.sites.__extract_scripts_once // YT ?
 // LinternaMagica.prototype.sites.__extract_scripts_wait_insert // FB

Modified: branches/task-11216/utilities/linternamagica_user_config.user.js
===================================================================
--- branches/task-11216/utilities/linternamagica_user_config.user.js    
2011-07-07 11:55:54 UTC (rev 118)
+++ branches/task-11216/utilities/linternamagica_user_config.user.js    
2011-07-07 13:41:41 UTC (rev 119)
@@ -46,7 +46,7 @@
     "controls": "self",
     "locale": "auto",
     "cookies": "restore",
-    "wait_dm": "off",
+    "wait_xhr": "off",
 };
 
 // Do NOT edit past this line.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]