InstaSynchP Bibby

Bibby specific changes

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        InstaSynchP Bibby
// @namespace   InstaSynchP
// @description Bibby specific changes

// @version     1.1.2
// @author      Zod-
// @source      https://github.com/Zod-/InstaSynchP-Bibby
// @license     MIT

// @include     *://instasync.com/r/*
// @include     *://*.instasync.com/r/*
// @grant       none
// @run-at      document-start

// @require     https://greasyfork.org/scripts/5647-instasynchp-library/code/InstaSynchP%20Library.js?version=37716
// ==/UserScript==

function Bibby(version) {
  'use strict';
  this.version = version;
  this.name = 'InstaSynchP Bibby';
  this.settings = [{
    label: 'Wallcounter limit notifications',
    id: 'wallcounter-limit-notify',
    type: 'checkbox',
    default: true,
    section: ['Bibby']
  }];
  this.isBibby = false;
}

Bibby.prototype.overwriteWallCreateFormat = function () {
  'use strict';
  var wallcounter = window.plugins.wallcounter;
  if (isUdef(wallcounter)) {
    return;
  }
  var oldCreateFormat = wallcounter.Wall.prototype.createFormat;
  wallcounter.Wall.prototype.createFormat = function () {
    var _this = this;
    if (_this.duration > 60 * 60) {
      return '<span style=\'color:red\'>' +
        oldCreateFormat.apply(_this, arguments) +
        '</span>';
    } else {
      return oldCreateFormat.apply(_this, arguments);
    }
  };
};

Bibby.prototype.checkWall = function (video) {
  'use strict';
  var message;
  var wall;
  var wallcounter = window.plugins.wallcounter;
  var addedby = video.addedby.toLowerCase();

  if (!gmc.get('wallcounter-limit-notify') ||
    gmc.get('add-video-log', false) ||
    isUdef(wallcounter) ||
    thisUser().username.toLowerCase() === addedby) {
    return;
  }
  wall = wallcounter.getWallForUsername(addedby);
  if (wall.duration < 60 * 60) {
    return;
  }
  message = wall.format('Wallcounter {0}', '{1}', '{2}');
  addErrorMessage(message);
};


Bibby.prototype.wallcounterNotification = function () {
  'use strict';
  events.on(this, 'AddVideo', this.checkWall);
};

Bibby.prototype.executeOnce = function () {
  'use strict';
  var _this = this;
  _this.isBibby = (window.room.roomName.toLowerCase() === 'bibby');
  if (!_this.isBibby) {
    return;
  }
  _this.overwriteWallCreateFormat();
};

Bibby.prototype.postConnect = function () {
  'use strict';
  var _this = this;
  if (!_this.isBibby) {
    return;
  }
  _this.wallcounterNotification();
};


Bibby.prototype.resetVariables = function () {
  'use strict';
  events.unbind('AddVideo', this.checkWall);
};

window.plugins = window.plugins || {};
window.plugins.bibby = new Bibby('1.1.2');