summaryrefslogtreecommitdiff
path: root/live/js
diff options
context:
space:
mode:
authorDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2007-12-16 23:49:24 +0000
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2007-12-16 23:49:24 +0000
commit06df85b5eadb9f088793df157b1dc5523a626db5 (patch)
treeb17b08bd6422f3da22a8bda037b2c7120d391b1b /live/js
parent0e2f88d8e717b1b3cbfbc6280eac932d31dfb631 (diff)
downloadvdr-plugin-live-06df85b5eadb9f088793df157b1dc5523a626db5.tar.gz
vdr-plugin-live-06df85b5eadb9f088793df157b1dc5523a626db5.tar.bz2
- Adapted Rolf Ahrenbergs patch for VLC streaming to current LIVE
development status. See Bug #343. This will need some additional tweaking.
Diffstat (limited to 'live/js')
-rw-r--r--live/js/live/browserwin.js97
-rw-r--r--live/js/live/pageenhance.js20
-rw-r--r--live/js/mootools/mootools.v1.11.js252
-rw-r--r--live/js/mootools/readme.mootools.config11
4 files changed, 345 insertions, 35 deletions
diff --git a/live/js/live/browserwin.js b/live/js/live/browserwin.js
new file mode 100644
index 0000000..e69e0f3
--- /dev/null
+++ b/live/js/live/browserwin.js
@@ -0,0 +1,97 @@
+/*
+ * This is part of the live vdr plugin. See COPYING for license information.
+ *
+ * browserwin.js
+ *
+ * BrowserWin class, BrowserWin.Manager class
+ *
+ * Extension of mootools to create and manage browser windows.
+ */
+
+/*
+Class: BrowserWin
+ Create and browswer window pointing at an specific URL.
+
+Arguments:
+
+Options:
+
+Note:
+*/
+var BrowserWin = new Class({
+ options: {
+ size: { width: 300, height: 200 },
+ toolbar: false,
+ location: false,
+ directories: false,
+ status: false,
+ menubar: false,
+ scrollbar: false,
+ resizable: true,
+ wm: false // overide default window manager.
+ },
+
+ initialize: function(id, url, options){
+ this.setOptions(options);
+ this.id = id;
+ this.wm = this.options.wm || BrowserWin.$wm;
+ this.wm.register(this, url);
+ },
+
+ create: function(url){
+ winOpts = "height=" + this.options.size.height;
+ winOpts += ",width=" + this.options.size.width;
+ winOpts += ",toolbar=" + this.options.toolbar;
+ winOpts += ",location=" + this.options.toolbar;
+ winOpts += ",directories=" + this.options.directories;
+ winOpts += ",status=" + this.options.status;
+ winOpts += ",menubar=" + this.options.menubar;
+ winOpts += ",scrollbars=" + this.options.scrollbars;
+ winOpts += ",resizable=" + this.options.resizable;
+ if ($defined(this.options.top)) {
+ winOpts += ",top=" + this.options.top;
+ }
+ if ($defined(this.options.left)) {
+ winOpts += ",left=" + this.options.left;
+ }
+ this.$winRef = window.open(url, this.id, winOpts);
+ }
+ });
+
+BrowserWin.implement(new Events, new Options);
+
+BrowserWin.Manager = new Class({
+ options: {
+ onRegister: Class.empty,
+ onUnregister: Class.empty
+ },
+
+ initialize: function(options){
+ this.setOptions(options);
+ this.hashTab = new Hash();
+ },
+
+ register: function(browserWin, url){
+ this.unregister(browserWin);
+
+ browserWin.create(url);
+ this.fireEvent('onRegister', [browserWin]);
+ this.hashTab.set(browserWin.id, browserWin);
+ },
+
+ unregister: function(browserWin){
+ if (this.hashTab.hasKey(browserWin.id)) {
+ winRef = this.hashTab.get(browserWin.id);
+ winRef.$winRef.close();
+ this.fireEvent('onUnregister', [winRef]);
+ }
+ this.hashTab.remove(browserWin.id);
+ }
+ });
+
+BrowserWin.Manager.implement(new Events, new Options);
+
+BrowserWin.$wm = null;
+window.addEvent('domready', function(){
+ BrowserWin.$wm = new BrowserWin.Manager();
+ });
diff --git a/live/js/live/pageenhance.js b/live/js/live/pageenhance.js
index 0cbf2ff..90df001 100644
--- a/live/js/live/pageenhance.js
+++ b/live/js/live/pageenhance.js
@@ -12,6 +12,10 @@ var PageEnhance = new Class({
options: {
epgLinkSelector: 'a[href^="epginfo.html?epgid"]',
actionLinkSelector: 'a[href^="vdr_request/"]',
+ vlcLinkSelector: 'a[href^="vlc.html?channel"]',
+ vlcWinOptions: {
+ size: { width: 420, height: 370 }
+ },
hintTipSelector: '*[title]',
hintClassName: 'hint',
infoWinOptions: {
@@ -40,6 +44,7 @@ var PageEnhance = new Class({
$$(this.options.epgLinkSelector).each(this.epgPopup.bind(this));
this.addHintTips($$(this.options.hintTipSelector));
$$(this.options.actionLinkSelector).each(this.vdrRequest.bind(this));
+ $$(this.options.vlcLinkSelector).each(this.vlcRequest.bind(this));
$$(this.options.datePickerSelector).each(this.datePicker.bind(this));
},
@@ -55,6 +60,7 @@ var PageEnhance = new Class({
elems = $$(sel);
this.addHintTips(elems);
$$('#' + id + ' ' + this.options.actionLinkSelector).each(this.vdrRequest.bind(this));
+ $$('#' + id + ' ' + this.options.vlcLinkSelector).each(this.vlcRequest.bind(this));
},
// Epg Popup function. Apply to all elements that should
@@ -106,6 +112,20 @@ var PageEnhance = new Class({
}.bindWithEvent(this, el));
},
+ // function that opens a window for streaming of tv data.
+ vlcRequest: function(el){
+ el.addEvent('click', function(event, element){
+ var href = $pick(element.href, "");
+ if (href != "") {
+ href += "&async=1";
+ var bw = new BrowserWin("vlcstream", href, this.options.vlcWinOptions);
+ event.stop();
+ return false;
+ }
+ return true;
+ }.bindWithEvent(this, el));
+ },
+
// change normal 'title'-Attributes into enhanced hinttips
// usesd by domExtend and domReadySetup functions.
addHintTips: function(elems){
diff --git a/live/js/mootools/mootools.v1.11.js b/live/js/mootools/mootools.v1.11.js
index ad6bfeb..eba43c7 100644
--- a/live/js/mootools/mootools.v1.11.js
+++ b/live/js/mootools/mootools.v1.11.js
@@ -286,7 +286,7 @@ document.head = document.getElementsByTagName('head')[0];
/*
Class: window
Some properties are attached to the window object by the browser detection.
-
+
Note:
browser detection is entirely object-based. We dont sniff.
@@ -1355,7 +1355,7 @@ Array.extend({
});
-/*
+/*
Script: Function.js
Contains Function prototypes and utility functions .
@@ -1389,11 +1389,11 @@ Function.extend({
If set to a class name, the function will receive a new instance of this class (with the event passed as argument's constructor) as first argument.
Default is false.
arguments - A single argument or array of arguments that will be passed to the function when called.
-
+
If both the event and arguments options are set, the event is passed as first argument and the arguments array will follow.
-
+
Default is no custom arguments, the function will receive the standard arguments when called.
-
+
delay - Numeric value: if set, the returned function will delay the actual execution by this amount of milliseconds and return a timer handle when called.
Default is no delay.
periodical - Numeric value: if set, the returned function will periodically perform the actual execution with this specified interval and return a timer handle when called.
@@ -3030,56 +3030,56 @@ Class: Elements
*/
Elements.extend({
-
+
/*
Property: filterByTag
Filters the collection by a specified tag name.
Returns a new Elements collection, while the original remains untouched.
*/
-
+
filterByTag: function(tag){
return new Elements(this.filter(function(el){
return (Element.getTag(el) == tag);
}));
},
-
+
/*
Property: filterByClass
Filters the collection by a specified class name.
Returns a new Elements collection, while the original remains untouched.
*/
-
+
filterByClass: function(className, nocash){
var elements = this.filter(function(el){
return (el.className && el.className.contains(className, ' '));
});
return (nocash) ? elements : new Elements(elements);
},
-
+
/*
Property: filterById
Filters the collection by a specified ID.
Returns a new Elements collection, while the original remains untouched.
*/
-
+
filterById: function(id, nocash){
var elements = this.filter(function(el){
return (el.id == id);
});
return (nocash) ? elements : new Elements(elements);
},
-
+
/*
Property: filterByAttribute
Filters the collection by a specified attribute.
Returns a new Elements collection, while the original remains untouched.
-
+
Arguments:
name - the attribute name.
operator - optional, the attribute operator.
value - optional, the attribute value, only valid if the operator is specified.
*/
-
+
filterByAttribute: function(name, operator, value, nocash){
var elements = this.filter(function(el){
var current = Element.getProperty(el, name);
@@ -3155,7 +3155,7 @@ function $ES(selector, filter){
$$.shared = {
'regexp': /^(\w*|\*)(?:#([\w-]+)|\.([\w-]+))?(?:\[(\w+)(?:([!*^$]?=)["']?([^"'\]]*)["']?)?])?$/,
-
+
'xpath': {
getParam: function(items, context, param, i){
@@ -3178,7 +3178,7 @@ $$.shared = {
items.push(temp.join(''));
return items;
},
-
+
getItems: function(items, context, nocash){
var elements = [];
var xpath = document.evaluate('.//' + items.join('//'), context, $$.shared.resolver, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
@@ -3187,9 +3187,9 @@ $$.shared = {
}
},
-
+
'normal': {
-
+
getParam: function(items, context, param, i){
if (i == 0){
if (param[2]){
@@ -3323,11 +3323,11 @@ Element.extend({
}
return el;
}/*compatibility*/,
-
- getElementsByClassName: function(className){
- return this.getElements('.' + className);
+
+ getElementsByClassName: function(className){
+ return this.getElements('.' + className);
}
-
+
/*end compatibility*/
});
@@ -3626,8 +3626,8 @@ Element.Events.domready = {
/*compatibility*/
-window.onDomReady = function(fn){
- return this.addEvent('domready', fn);
+window.onDomReady = function(fn){
+ return this.addEvent('domready', fn);
};
/*end compatibility*/
@@ -3635,7 +3635,7 @@ window.onDomReady = function(fn){
/*
Script: Window.Size.js
Window cross-browser dimensions methods.
-
+
Note:
The Functions in this script require an XHTML doctype.
@@ -3758,7 +3758,7 @@ var Drag = {};
/*
Class: Drag.Base
Modify two css properties of an element based on the position of the mouse.
-
+
Note:
Drag.Base requires an XHTML doctype.
@@ -3780,7 +3780,7 @@ Options:
limit:
x - array with start and end limit relative to modifiers.x
y - array with start and end limit relative to modifiers.y
-
+
Events:
onStart - optional, function to execute when the user starts to drag (on mousedown);
onComplete - optional, function to execute when the user completes the drag.
@@ -4060,7 +4060,7 @@ Options:
encoding - the encoding, defaults to utf-8.
autoCancel - cancels the already running request if another one is sent. defaults to false.
headers - accepts an object, that will be set to request headers.
-
+
Events:
onRequest - function to execute when the XHR request is fired.
onSuccess - function to execute when the XHR request completes.
@@ -4225,7 +4225,7 @@ Options:
update - $(element) to insert the response text of the XHR into, upon completion of the request.
evalScripts - boolean; default is false. Execute scripts in the response text onComplete. When the response is javascript the whole response is evaluated.
evalResponse - boolean; default is false. Force global evalulation of the whole response, no matter what content-type it is.
-
+
Events:
onComplete - function to execute when the ajax request completes.
@@ -4446,6 +4446,198 @@ var Json = {
};
/*
+Script: Hash.js
+ Contains the class Hash.
+
+License:
+ MIT-style license.
+*/
+
+/*
+Class: Hash
+ It wraps an object that it uses internally as a map. The user must use set(), get(), and remove() to add/change, retrieve and remove values, it must not access the internal object directly. null/undefined values are allowed.
+
+Note:
+ Each hash instance has the length property.
+
+Arguments:
+ obj - an object to convert into a Hash instance.
+
+Example:
+ (start code)
+ var hash = new Hash({a: 'hi', b: 'world', c: 'howdy'});
+ hash.remove('b'); // b is removed.
+ hash.set('c', 'hello');
+ hash.get('c'); // returns 'hello'
+ hash.length // returns 2 (a and c)
+ (end)
+*/
+
+var Hash = new Class({
+
+ length: 0,
+
+ initialize: function(object){
+ this.obj = object || {};
+ this.setLength();
+ },
+
+ /*
+ Property: get
+ Retrieves a value from the hash.
+
+ Arguments:
+ key - The key
+
+ Returns:
+ The value
+ */
+
+ get: function(key){
+ return (this.hasKey(key)) ? this.obj[key] : null;
+ },
+
+ /*
+ Property: hasKey
+ Check the presence of a specified key-value pair in the hash.
+
+ Arguments:
+ key - The key
+
+ Returns:
+ True if the Hash contains a value for the specified key, otherwise false
+ */
+
+ hasKey: function(key){
+ return (key in this.obj);
+ },
+
+ /*
+ Property: set
+ Adds a key-value pair to the hash or replaces a previous value associated with the key.
+
+ Arguments:
+ key - The key
+ value - The value
+ */
+
+ set: function(key, value){
+ if (!this.hasKey(key)) this.length++;
+ this.obj[key] = value;
+ return this;
+ },
+
+ setLength: function(){
+ this.length = 0;
+ for (var p in this.obj) this.length++;
+ return this;
+ },
+
+ /*
+ Property: remove
+ Removes a key-value pair from the hash.
+
+ Arguments:
+ key - The key
+ */
+
+ remove: function(key){
+ if (this.hasKey(key)){
+ delete this.obj[key];
+ this.length--;
+ }
+ return this;
+ },
+
+ /*
+ Property: each
+ Calls a function for each key-value pair. The first argument passed to the function will be the value, the second one will be the key, like $each.
+
+ Arguments:
+ fn - The function to call for each key-value pair
+ bind - Optional, the object that will be referred to as "this" in the function
+ */
+
+ each: function(fn, bind){
+ $each(this.obj, fn, bind);
+ },
+
+ /*
+ Property: extend
+ Extends the current hash with an object containing key-value pairs. Values for duplicate keys will be replaced by the new ones.
+
+ Arguments:
+ obj - An object containing key-value pairs
+ */
+
+ extend: function(obj){
+ $extend(this.obj, obj);
+ return this.setLength();
+ },
+
+ /*
+ Property: merge
+ Merges the current hash with multiple objects.
+ */
+
+ merge: function(){
+ this.obj = $merge.apply(null, [this.obj].extend(arguments));
+ return this.setLength();
+ },
+
+ /*
+ Property: empty
+ Empties all hash values properties and values.
+ */
+
+ empty: function(){
+ this.obj = {};
+ this.length = 0;
+ return this;
+ },
+
+ /*
+ Property: keys
+ Returns an array containing all the keys, in the same order as the values returned by <Hash.values>.
+
+ Returns:
+ An array containing all the keys of the hash
+ */
+
+ keys: function(){
+ var keys = [];
+ for (var property in this.obj) keys.push(property);
+ return keys;
+ },
+
+ /*
+ Property: values
+ Returns an array containing all the values, in the same order as the keys returned by <Hash.keys>.
+
+ Returns:
+ An array containing all the values of the hash
+ */
+
+ values: function(){
+ var values = [];
+ for (var property in this.obj) values.push(this.obj[property]);
+ return values;
+ }
+
+});
+
+/* Section: Utility Functions */
+
+/*
+Function: $H
+ Shortcut to create a Hash from an Object.
+*/
+
+function $H(obj){
+ return new Hash(obj);
+};
+
+/*
Script: Tips.js
Tooltips, BubbleTips, whatever they are, they will appear on mouseover
@@ -4482,7 +4674,7 @@ Options:
offsets - the distance of your tooltip from the mouse. an Object with x/y properties.
fixed - if set to true, the toolTip will not follow the mouse.
-
+
Events:
onShow - optionally you can alter the default onShow behaviour with this option (like displaying a fade in effect);
onHide - optionally you can alter the default onHide behaviour with this option (like displaying a fade out effect);
diff --git a/live/js/mootools/readme.mootools.config b/live/js/mootools/readme.mootools.config
index edc3cef..f82f31b 100644
--- a/live/js/mootools/readme.mootools.config
+++ b/live/js/mootools/readme.mootools.config
@@ -19,11 +19,12 @@ live. In order to obtain the right mootools configuration follow these steps:
- Scroll down to the bottom of the page and select the following
options towards the top of the download page in this order:
1. Tips
- 2. Json
- 3. Ajax
- 4. Drag.Move
- 5. Window.DomReady
- 6. Element.Selectors
+ 2. Hash
+ 3. Json
+ 4. Ajax
+ 5. Drag.Move
+ 6. Window.DomReady
+ 7. Element.Selectors
- Then open 'Choose compression type' and select 'No Compression' to
have fully documented mootools source. This helps when developing