Common.js
From MusicTechWiki
Revision as of 19:43, 20 May 2021 by AndrewFitzgerald (talk | contribs)
Revision as of 19:43, 20 May 2021 by AndrewFitzgerald (talk | contribs)
Note: After saving, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
/* Any JavaScript here will be loaded for all users on every page load. */
function popupvideo(url, width, height)
{
mediaplayerPopup = window.open(url, 'VideoWin','location=no,scrollbars=no,width=' + width + ',height=' + height);
mediaplayerPopup.focus();
return false;
}
function playpopupvideo(id)
{
// remove the false later
if (typeof mediaplayerPopup != "undefined" )
{
playnextvideo(popplaylist[id][0], popplaylist[id][1], popplaylist[id][2]);
}
else
{
popupvideo(popplaylist[id][0], popplaylist[id][1], popplaylist[id][2]);
}
currentlyplaying = id;
}
function playnextvideo(url, width, height)
{ if ((typeof mediaplayerPopup == "undefined") || mediaplayerPopup.closed || (typeof mediaplayerPopup.updateWindow=="undefined"))
{ popupvideo(url, width, height);
}
else
{
mediaplayerPopup.updateWindow(url, width, height);
}
}
function popupplay()
{
mediaplayerPopup.player.sendEvent('PLAY');
return false;
}
function popupListener(msg)
{
if (currentlyplaying < playlistcounter)
{
playpopupvideo(currentlyplaying + 1);
}
}
function popupClosed()
{
mediaplayerPopup = false;
}
if ( mw.config.get( 'wgCanonicalSpecialPageName' ) === 'Movepage' ) { $( function () { i= $( 'input[name=wpLeaveRedirect]' ); if ( i.length ) { i[0].checked = false; } } ) }
if (typeof jwplayer !== 'undefined') {
checkURLforTimestamp();
}
function checkURLforTimestamp()
{
var url_string = window.location.href
var url = new URL(url_string);
if (!url) { return; }
var timestamp = url.searchParams.get("timestamp");
//const queryString = window.location.search;
//const urlParams = new URLSearchParams(queryString);
//timestamp = urlParams.get('timestamp');
if (!timestamp) { return; }
timeArr = timestamp.split(":");
if (timeArr.length == 2)
{
alert(timeArr[0] * 60);
alert(timeArr[1]);
timestamp = (parseInt(timeArr[0]) * 60) + parseInt(timeArr[1]);
}
else if (timeArr.length == 3)
{
timestamp = (parseInt(timeArr[0]) * 3600) + (parseInt(timeArr[1]) * 60) + parseInt(timeArr[2]);
}
if (timestamp) { jwplayer().seek(timestamp); }
}