There are 6 previous versions of this script.
// Walla VOD user script
// version 1.0
// 2009-04-21
//
// Copyright (c) 2007,2009 Yehuda B.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script. To install it, you need
// Greasemonkey 0.6.6 or later: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "Walla VOD", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name Walla VOD
// @namespace tag:yehudab@gmail.com,2007-01-29:gm
// @description Fix display and navigation issues in Walla and Yes web site. Version 1.0
// @include http://*.walla.co.il/*
// @include http://yes.co.il/*
// @include http://*.yes.co.il/*
// ==/UserScript==
function fixOnclick(tagName)
{
var elements = document.getElementsByTagName(tagName);
var onclickRE = /onclick="top\.location/g;
if (elements != null)
{
for (var i = 0; i < elements.length; i++) {
if (elements[i].innerHTML.match(onclickRE))
elements[i].innerHTML = elements[i].innerHTML.replace(onclickRE, "onclick=\"location");
}
}
}
function skipAdd(obj, clipURL, width, height)
{
if (typeof obj == "string")
obj = document.getElementById(obj);
try
{
window.setTimeout(function() {
GM_xmlhttpRequest({
method:"GET",
url:clipURL,
onload:function(details) {
if (details.status != 200)
{
GM_log("Unable to load video: " + clipURL, 2);
}
else
{
var videoUrl = clipURL;
var allTags = details.responseText.match(/<[^>]+>/g);
var i, l = allTags == null ? 0 : allTags.length;
if (l == 0)
{
GM_log("asx is empty");
return;
}
var inEntry = false;
var canSkip = false;
var tagName;
var haveVideoURL = false;
for (i = 0; i < l; i++)
{
tagName = allTags[i].match(/[a-zA-Z]+/);
if (tagName != null)
{
tagName = tagName[0].toLowerCase();
switch (tagName)
{
case "entry":
if (!inEntry)
{
inEntry = true;
canSkip = true;
haveVideoURL = false;
if (allTags[i].match(/clientskip="no"/i))
canSkip = false;
else
canSkip = true;
}
else
{
inEntry = false;
if (canSkip && haveVideoURL)
{
obj.innerHTML = getPlayerHtml(videoUrl, width, height);
return;
}
}
break;
case "ref":
if (canSkip)
{
var href = allTags[i].match(/href\w*=\w*"[^"]+"/i);
var promo = allTags[i].match(/video\/promo\//i);
if (href != null && promo == null)
{
videoUrl = href[0].replace(/^.*"([^"]+)".*$/, "$1");
haveVideoURL = true;
}
}
break;
}
}
}
obj.innerHTML = getPlayerHtml(videoUrl, width, height);
}
}
});
}, 0);
}
catch (ex)
{
GM_log(ex);
}
}
function getPlayerHtml(url, width, height)
{
GM_log(url);
return "<EMBED type='application/x-mplayer2' width='" + width +"' height='" + height + "' " +
"src='" + url + "' autostart='1' showcontrols='1' loop='0'></EMBED>" +
"<br><a href=\"" + url + "\">\u05dc\u05e6\u05e4\u05d9\u05d4 \u05d9\u05e9\u05d9\u05e8\u05d4</a>"; // לצפיה ישירה
}
unsafeWindow.fixPlayer = function(count)
{
if (typeof unsafeWindow.Attemps2FindPlayer != "undefined")
{
unsafeWindow.Attemps2FindPlayer = function() {}
document.getElementById("playerDiv").style.display="";
document.getElementById("MainAdsDiv").style.display="";
document.getElementById("EndScreen").style.display="";
document.getElementById("InstallAddons").style.display="";
}
var playerDiv = document.getElementById("playerDiv");
if (playerDiv != null)
{
var urlParamRE = /<param[^>]*name\w*=\w*"url"[^>]*>/i;
var urlParam = playerDiv.innerHTML.match(urlParamRE);
var url = '';
if (urlParam != null) {
var urlValueRE = /value\w*=\w*"([^"]+)"[^>]*>/i;
var urlValue = urlParam[0].match(urlValueRE);
if (urlValue != null)
url = urlValue[1];
}
if (url == "") {
if (count < 10) {
GM_log("retry in 1 sec...");
window.setTimeout("fixPlayer(" + (count + 1) +")", 1000);
}
return;
}
GM_log(url);
var width = 464;
var height = 350;
var whRE = /<object[^>]*width\w*=\w*"([^"]+)"/i;
var wh = playerDiv.innerHTML.match(whRE);
if (wh != null) {
width = wh[1];
}
var whRE = /<object[^>]*height\w*=\w*"([^"]+)"/i;
var wh = playerDiv.innerHTML.match(whRE);
if (wh != null) {
height = wh[1];
}
skipAdd(playerDiv, url, width, height);
}
var tdPlay = document.getElementById("td_play");
if (tdPlay != null)
{
var containerDiv = tdPlay.parentNode.parentNode.parentNode;
containerDiv2 = containerDiv.parentNode;
if (containerDiv2.innerHTML.match(/id="playerDiv"/))
containerDiv.style.display="none";
else
containerDiv2.style.display="none";
}
}
function fixPerformance()
{
unsafeWindow.ScrollFinanceDiv = function() {};
unsafeWindow.ScrollNewsDiv = function() {};
}
function fixMenus()
{
unsafeWindow.wm_hidePopup = function(e){
if (unsafeWindow.wm_openPopup!=null) {
unsafeWindow.wm_openPopup.style.display="none";
unsafeWindow.wm_openPopup=null;
}
document.removeEventListener('mouseout', unsafeWindow.wm_hidePopup, false);
}
unsafeWindow.wm_showPopup = function(objname,noevent) {
var obj=document.getElementById(objname);
if (obj==null) return;
if (unsafeWindow.wm_openPopup!=null) {
unsafeWindow.wm_hidePopup();
}
unsafeWindow.wm_openPopup=obj;
obj.style.display="block";
document.addEventListener('mouseout', unsafeWindow.wm_hidePopup, false);
}
}
fixOnclick("table");
unsafeWindow.fixPlayer(0);
fixPerformance();
if (unsafeWindow.wm_showPopup)
fixMenus();
