🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

InstaSynchP Bump Command

Command to bump a video from a user or url

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

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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        InstaSynchP Bump Command
// @namespace   InstaSynchP
// @description Command to bump a video from a user or url

// @version     1.0.3
// @author      Zod-
// @source      https://github.com/Zod-/InstaSynchP-Bump-Command
// @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 Bump(version) {
  "use strict";
  this.version = version;
  this.name = "InstaSynchP Bump Command";
  this.commands = {
    "'bump": {
      'hasArguments': true,
      'type': 'mod',
      'reference': this,
      'description': 'Bumps a video from a user or the url. Position can be specified',
      'callback': this.execute
    }
  };
  this.bumpInfo = undefined;
  this.bumpTo = undefined;
}

Bump.prototype.executeOnce = function () {
  var th = this;
  //bind event for bumping an url
  events.on(th, 'AddVideo', function (vidinfo) {
    //bump the video after it got added
    if (videoInfoEquals(vidinfo.info, th.bumpInfo)) {
      sendcmd('move', {
        info: vidinfo.info,
        position: th.bumpTo
      });
      th.bumpInfo = undefined;
      th.bumpTo = undefined;
    }
  });

};

Bump.prototype.execute = function (opts) {
  "use strict";
  var th = this,
    user = opts.usernames[0],
    i,
    activeIndex = activeVideoIndex(),
    bumpIndex = -1,
    playlist = window.room.playlist.videos;
  th.bumpTo = opts.numbers.length > 0 ? opts.numbers[0] : activeVideoIndex() + 1;
  th.bumpInfo = opts.videos[0];

  //return if nothing to bump got found
  if (!user && !th.bumpInfo) {
    addSystemMessage('Nothing found to bump: \'bump [user] [url] [position]');
    return;
  }

  //search the video to be bumped
  for (i = playlist.length - 1; i >= 0; i -= 1) {
    if (videoInfoEquals(playlist[i].info, th.bumpInfo) ||
      (user && playlist[i].addedby.toLowerCase() === user.toLowerCase())) {
      bumpIndex = i;
      break;
    }
  }
  //video not found
  if (bumpIndex === -1) {
    //no link provided
    if (!th.bumpInfo) {
      addSystemMessage("The user didn't add any videos");
    } else {
      //add the video and bump it in the addVideo event
      sendcmd('add', {
        URL: urlParser.create({
          videoInfo: th.bumpInfo
        })
      });
    }
  } else {
    sendcmd('move', {
      info: playlist[bumpIndex].info,
      position: th.bumpTo
    });
    th.bumpTo = undefined;
    th.bumpInfo = undefined;
  }
};

window.plugins = window.plugins || {};
window.plugins.bump = new Bump('1.0.3');