There are 6 previous versions of this script.
// Ynet video for mac user script
// version 1.2
// 2010-03-04
// Copyright (c) 2007, 2010 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.
//
// ==UserScript==
// @name Ynet video for mac
// @namespace tag:yehudab@gmail.com,2007-01-29:gm
// @description Allow inline display of Ynet video clips on Mac, Linux and Windows. Version 1.2
// @include http://*.ynet.co.il/*
// ==/UserScript==
function skipAdds(playerContainer, videoId, width, height, subdomain) {
var xmlUrl = 'http://' + subdomain + '.ynet.co.il/Cmn/App/Video/CmmVideoPlayList/0,12903,' + videoId + ',00.xml';
var onloadFunc = function(details) {
try {
if (details.status != 200)
{
GM_log("Unable to load video: " + xmlUrl, 2);
}
else
{
// Inject responseXML into existing Object if not present
if (!details.responseXML) {
details.responseXML = new DOMParser().parseFromString(details.responseText, "text/xml");
}
var xmlDoc=details.responseXML.documentElement;
var videoUrl = xmlDoc.getElementsByTagName("movie")[0].getAttribute('url');
playerContainer.innerHTML = getPlayerHtml(videoUrl, width, height);
}
}
catch (ex)
{
GM_log(ex);
}
}
window.setTimeout(function() {
GM_xmlhttpRequest({
method:"GET",
url:xmlUrl,
onerror:function(details) {
GM_log("Unable to load video: " + xmlUrl, 2);
},
onload: onloadFunc
});
}, 0);
if (typeof unsafeWindow.pageRefreshDisable != 'undefined')
unsafeWindow.pageRefreshDisable();
}
if (document.location.href.match(/hot.ynet.co.il/)) {
unsafeWindow.buildFlashPlayer = function(playerType, videoId, width, height, params) {
subdomain = 'hot';
var playerContainer = document.getElementById('vidObj');
skipAdds(playerContainer, videoId, width, height, subdomain);
}
}
else {
unsafeWindow.activateFlashPlayer = function(video_id) {
var playerContainer = document.getElementById('HtmlTVPlayer' + video_id);
var width = playerContainer.offsetWidth;
var height = playerContainer.offsetHeight;
skipAdds(playerContainer, video_id, width, height, 'www');
}
}
function getPlayerHtml(url, width, height)
{
return "<embed src='http://yehudab.com/apps/ynet/player.swf' FlashVars='movie=" + encodeURIComponent(url) +
"&bgcolor=0x051615&fgcolor=0x13ABEC&volume=70&autoplay=on&autoload=on&autorewind=on&clickurl=&clicktarget=&postimage=' width='" +
width + "' height='" + height + "' allowFullScreen='true' type='application/x-shockwave-flash'>" +
"<a target=\"_new\" style=\"float:right;color:black;text-decoration:none;display:block;\" href=\"" + url + "\">\u05dc\u05e6\u05e4\u05d9\u05d4 \u05d9\u05e9\u05d9\u05e8\u05d4</a>";
}
