NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name SDMB fix Skype icons
// @namespace cbf7dfe834817939e241a1e07de7245b
// @description Fixes broken Skype icons due to changes in how Skype works
// @version 3
// @match http://boards.straightdope.com/sdmb/*
// @grant none
// @run-at document-start
// @require https://raw.githubusercontent.com/uzairfarooq/arrive/master/src/arrive.js
// ==/UserScript==
var iconURL = 'http://boards.straightdope.com/sdmb/images/misc/im_skype.gif';
var oldIconURL = 'images/misc/im_skype.gif'; //Used in popup. Changed to make it consistent
var style = document.createElement('style'); style.innerHTML =
'img[src^="http://mystatus.skype.com/smallicon/"], img[src="' + oldIconURL +'"] {'
+ 'width: 17px; padding: 17px 0 0 0; height: 0;'
+ 'background: url("'+ iconURL + '") no-repeat;'
+ 'overflow: hidden;'
+ 'display: initial !important'
+ '}' +
'img[src^="http://mystatus.skype.com/"] {' //hides status in popup which no longer works
+ 'display: none;'
+ '}';
style.id = "SDMBfixSkypeIcons";
if (document.head) {
document.head.appendChild(style);
} else if (document.arrive) {
document.arrive('head', { onceOnly: true }, function() { document.head.appendChild(style) });
} else {
setTimeOut (function() { document.head.appendChild(style); }, 25);
}
if (document.arrive) {
document.arrive('img[src^="http://mystatus.skype.com/smallicon/', { existing: true }, function(el) { el.src = iconURL; });
} else {
addEventListener('DOMContentLoaded', function() {
var img = document.querySelectorAll('img[src^="http://mystatus.skype.com/smallicon/');
for (var i = 0; i < img.length; i++) img[i].src = iconURL;
if (!document.getElementById('SDMBfixSkypeIcons') ) document.head.appendChild(style);
});
}
if (document.URL.search('sendmessage.php?do=im&type=skype') == -1) { //skype popup
setInterval( function() { //disable broken check for Skype
skypeCheck = function() {};
SkypeDetection = undefined;
}, 50); //repeat to keep script from enabling check
}
/* //delete this line if the Skype window is too small for your liking.
if (document.URL.search('sendmessage.php?do=im&type=skype') == -1) { //resize window to fit
var style2 = document.createElement('style');
style2.innerHTML = '#skypedetectionswf { display: none; }';
document.head.appendChild(style2);
addEventListener('DOMContentLoaded', function(){
resizeWindow();
});
addEventListener('load', function(){ //repeating in case the first doesn't take
setTimeout(resizeWindow, 100);
});
}
function resizeWindow() {
var heightOffset = window.outerHeight - window.innerHeight;
var widthOffset = window.outerWidth - window.innerWidth;
var height = document.body.clientHeight + heightOffset;
var width = document.body.clientWidth + widthOffset;
window.resizeTo(width, height);
console.warn('hello');
}
/**/