OFFLINE ALERT

When in Work Offline Mode, the webpage you are on will display OFFLINE to alert you that you are in Offline Mode.

Από την 30/03/2014. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name           OFFLINE ALERT
// @author         Written by Jefferson Scher
// @namespace      Requested by *Barbiegirl* (thread http://userscripts.org/topics/91003)(thankyou Jefferson)
// @description    When in Work Offline Mode, the webpage you are on will display OFFLINE to alert you that you are in Offline Mode.
// @version        1.0
// @include        http://*
// @include        https://*
// @include        *
// @include        about:blank
// @include        about:newtab
// @include        about:*
// @include        data:image/*
// @include        file:///*
// @include        file:*
// @include        file:///C:/Users/*
// @include        file:///*
// @include        file:///*.PNG
// ==/UserScript==


GM_addStyle("#offlinenotice{position:fixed!important;top:0!important;left:0!important;background:#ccc!important;opacity:0.95!important;padding:25% 0!important;text-align:center!important;z-index:999!important;color:#CC0000!important;font-family:verdana!important;font-size:10em!important;}");

function offNotice(e){
  var d = document.createElement("div");
  d.id = "offlinenotice";
  d.style.height = window.innerHeight + "px";
  d.style.width = window.innerWidth + "px";
  d.appendChild(document.createTextNode("OFFLINE"));
  document.body.appendChild(d);
}

function removeNotice(e){
  var d = document.getElementById("offlinenotice");
  if (d) d.parentNode.removeChild(d);
}

document.body.addEventListener("offline", offNotice, false);
document.body.addEventListener("online", removeNotice, false);

function offNotice(e){
  var d = document.createElement("div");
  d.id = "offlinenotice";
  d.style.height = window.innerHeight + "px";
  d.style.width = window.innerWidth + "px";
  d.appendChild(document.createTextNode("OFFLINE"));
  document.body.appendChild(d);
  // Hide Flash players
  var players = document.querySelectorAll("object, embed");
  for (var i=0; i<players.length; i++){
    if (players[i].hasAttribute("type")){ if (players[i].getAttribute("type") == "application/x-shockwave-flash"){
      if (window.getComputedStyle(players[i],null).getPropertyValue("visibility") == "visible"){
        players[i].style.visibility = "hidden";
        players[i].setAttribute("offlinehidden", "yes");
      }
    }}
  }
}

function removeNotice(e){
  var d = document.getElementById("offlinenotice");
  if (d) d.parentNode.removeChild(d);
  // Restore Flash players
  var restoreset = document.querySelectorAll("object[offlinehidden], embed[offlinehidden]");
  for (var i=0; i<restoreset.length; i++){
    restoreset[i].style.visibility = "visible";
    restoreset[i].removeAttribute("offlinehidden");
  }
}