tela jsfiddle estranho, isso é um vírus?

1

Eu tenho a foto abaixo quando eu tinha o site jsfiddle aberto no chrome quando minha internet foi desconectada. Isto é uma característica do jsfiddle ou isto é algum tipo de software malicioso na minha máquina? A mesma coisa acontece no último IE.

    
por akonsu 18.07.2015 / 22:29

1 resposta

1

Esta é uma característica do jsfiddle?

is this a some sort of malicious software on my machine?

Não, não é malicioso. Parece que pretende ser divertido.

A mensagem é exibida por alguns JavaScript que são carregados do site do JSFiddle - presumivelmente quando ele detecta sua internet está com problemas.

content: "Seems like you've gone offline, you might want to wait until your network comes back before continuing.

This message will self-destruct once you're online again.",

link

// Generated by CoffeeScript 1.4.0
(function() {
  var Heyoffline, addEvent, destroy, extend, setStyles,
    __slice = [].slice,
    __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

  extend = function() {
    var ext, extensions, key, obj, value, _i, _len;
    obj = arguments[0], extensions = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
    for (_i = 0, _len = extensions.length; _i < _len; _i++) {
      ext = extensions[_i];
      for (key in ext) {
        value = ext[key];
        obj[key] = value;
      }
    }
    return obj;
  };

  addEvent = function(element, event, fn, useCapture) {
    if (useCapture == null) {
      useCapture = false;
    }
    return element.addEventListener(event, fn, useCapture);
  };

  setStyles = function(element, styles) {
    var key, value, _results;
    _results = [];
    for (key in styles) {
      value = styles[key];
      _results.push(element.style[key] = !isNaN(value) ? "" + value + "px" : value);
    }
    return _results;
  };

  destroy = function(element) {
    return element.parentNode.removeChild(element);
  };

  Heyoffline = (function() {

    Heyoffline.prototype.options = {
      text: {
        title: "You're currently offline",
        content: "Seems like you've gone offline,                you might want to wait until your network comes back before continuing.<br /><br />                This message will self-destruct once you're online again.",
        button: "Relax, I know what I'm doing"
      },
      monitorFields: false,
      prefix: 'heyoffline',
      noStyles: false,
      disableDismiss: false,
      elements: ['input', 'select', 'textarea', '*[contenteditable]']
    };

    Heyoffline.prototype.modified = false;

    function Heyoffline(options) {
      this.hideMessage = __bind(this.hideMessage, this);

      this.offline = __bind(this.offline, this);

      this.online = __bind(this.online, this);
      extend(this.options, options);
      this.setup();
    }

    Heyoffline.prototype.setup = function() {
      this.events = {
        element: ['keyup', 'change'],
        network: ['online', 'offline']
      };
      this.elements = {
        fields: document.querySelectorAll(this.options.elements.join(',')),
        overlay: document.createElement('div'),
        modal: document.createElement('div'),
        heading: document.createElement('h2'),
        content: document.createElement('p'),
        button: document.createElement('a')
      };
      this.defaultStyles = {
        overlay: {
          position: 'absolute',
          top: 0,
          left: 0,
          width: '100%',
          background: 'rgba(0, 0, 0, 0.3)'
        },
        modal: {
          padding: 15,
          background: '#fff',
          boxShadow: '0 2px 30px rgba(0, 0, 0, 0.3)',
          width: 450,
          margin: '0 auto',
          position: 'relative',
          top: '30%',
          color: '#444',
          borderRadius: 2,
        },
        heading: {
          fontSize: '1.7em',
          paddingBottom: 15
        },
        content: {
          paddingBottom: 15
        },
        button: {
          fontWeight: 'bold',
          cursor: 'pointer'
        }
      };
      return this.attachEvents();
    };

    Heyoffline.prototype.createElements = function() {
      this.createElement(document.body, 'overlay');
      this.resizeOverlay();
      this.createElement(this.elements.overlay, 'modal');
      this.createElement(this.elements.modal, 'heading', this.options.text.title);
      this.createElement(this.elements.modal, 'content', this.options.text.content);
      if (!this.options.disableDismiss) {
        this.createElement(this.elements.modal, 'button', this.options.text.button);
        return addEvent(this.elements.button, 'click', this.hideMessage);
      }
    };

    Heyoffline.prototype.createElement = function(context, element, text) {
      this.elements[element].setAttribute('class', "" + this.options.prefix + "_" + element);
      this.elements[element] = context.appendChild(this.elements[element]);
      if (text) {
        this.elements[element].innerHTML = text;
      }
      if (!this.options.noStyles) {
        return setStyles(this.elements[element], this.defaultStyles[element]);
      }
    };

    Heyoffline.prototype.resizeOverlay = function() {
      return setStyles(this.elements.overlay, {
        height: window.innerHeight
      });
    };

    Heyoffline.prototype.destroyElements = function() {
      if (this.elements.overlay) {
        return destroy(this.elements.overlay);
      }
    };

    Heyoffline.prototype.attachEvents = function() {
      var event, field, _i, _j, _len, _len1, _ref, _ref1,
        _this = this;
      _ref = this.elements.fields;
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
        field = _ref[_i];
        this.elementEvents(field);
      }
      _ref1 = this.events.network;
      for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
        event = _ref1[_j];
        this.networkEvents(event);
      }
      return addEvent(window, 'resize', function() {
        return _this.resizeOverlay();
      });
    };

    Heyoffline.prototype.elementEvents = function(field) {
      var event, _i, _len, _ref, _results,
        _this = this;
      _ref = this.events.element;
      _results = [];
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
        event = _ref[_i];
        _results.push((function(event) {
          return addEvent(field, event, function() {
            return _this.modified = true;
          });
        })(event));
      }
      return _results;
    };

    Heyoffline.prototype.networkEvents = function(event) {
      return addEvent(window, event, this[event]);
    };

    Heyoffline.prototype.online = function() {
      return this.hideMessage();
    };

    Heyoffline.prototype.offline = function() {
      if (this.options.monitorFields) {
        if (this.modified) {
          return this.showMessage();
        }
      } else {
        return this.showMessage();
      }
    };

    Heyoffline.prototype.showMessage = function() {
      this.createElements();
      if (this.options.onOnline) {
        return this.options.onOnline.call(this);
      }
    };

    Heyoffline.prototype.hideMessage = function(event) {
      if (event) {
        event.preventDefault();
      }
      this.destroyElements();
      if (this.options.onOffline) {
        return this.options.onOffline.call(this);
      }
    };

    return Heyoffline;

  })();

  addEvent(window, 'load', function() {
    return window.Heyoffline = new Heyoffline;
  });

}).call(this);
    
por 19.07.2015 / 00:02