NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name PremierLeaguePass timezone converter
// @version 0.2
// @description Converts the times on the PremierLeaguePass schedule to your local timezone, instead of British Standard Time.
// @match http://premierleaguepass.com/plp/*
// @match http://www.premierleaguepass.com/plp/*
// @require http://code.jquery.com/jquery-latest.js
// @require http://cdnjs.cloudflare.com/ajax/libs/jstimezonedetect/1.0.4/jstz.js
// @require http://cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.1/moment.js
// @require http://momentjs.com/downloads/moment-timezone-with-data-2010-2020.js
// @copyright 2014, Patrick Barnes
// ==/UserScript==
var elements = $('.fullTimeInfo');
var localTZ = jstz.determine(); // Determines the time zone of the browser client
elements.each(function() {
try{
var dateSpan = $(this).find('.date_info')[0];
var date = dateSpan.textContent;
var timeSpan = $(this).find('.time_info')[0];
var time = timeSpan.textContent.split(" ")[0];
var timeLondon = moment.tz(date + " " + time, "DD/MM/YY HH:mm", "Europe/London");
dateSpan.textContent = timeLondon.tz(localTZ.name()).format("DD/MM/YY");
timeSpan.textContent = timeLondon.tz(localTZ.name()).format("HH:mm");
}
catch (e){
var text = $(this)[0].textContent.split(" ")[0];
var timeLondon = moment.tz(text, "HH:mm", "Europe/London");
$(this)[0].textContent = timeLondon.tz(localTZ.name()).format("HH:mm");
}
});
elements = $('.dateTitle');
elements.each(function() {
var text = $(this)[0].textContent;
var timeLondon = moment.tz(text + "14:00", "DD/MM/YYYY HH:mm", "Europe/London");
$(this)[0].textContent = timeLondon.tz(localTZ.name()).format("DD/MM/YYYY");
});
var label = $('.label')[0];
if(label.textContent != "CURRENT FIXTURES"){
var dates = label.textContent.split(" - ");
var date1 = moment.tz(dates[0] + "14:00", "DD/MM/YYYY HH:mm", "Europe/London");
var date2 = moment.tz(dates[1] + "14:00", "DD/MM/YYYY HH:mm", "Europe/London");
label.textContent = date1.tz(localTZ.name()).format("DD/MM/YYYY") + " - " + date2.tz(localTZ.name()).format("DD/MM/YYYY") ;
}