Polyv Shorcode

Polyv Shorcode for wordpress.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Polyv Shorcode
// @namespace    https://www.iplaysoft.com
// @version      0.41
// @description  Polyv Shorcode for wordpress.
// @author       X-Force
// @match        http://my.polyv.net/*
// @match        https://my.polyv.net/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    if(window.location.protocol != "https:"){
        var newUrl = window.location.href.replace("http://", "https://");
        window.location=newUrl;
    }

    //Remove KeFu
    setTimeout(function(){
        //document.getElementById( 'zhichiBtn' ).style.display = 'none';
        var elem = document.getElementById( 'zhichiBtnBox' );
        elem.parentNode.removeChild(elem);
    },1500);

    var template = '[video url="{{url}}" youku="" vqq="" bilibili=""]{{url}}[/video]';
    var urlBase = 'https://share.polyv.net/front/video/preview?vid=';

    var vids = document.getElementsByClassName("video-list__duration");
    for(var i=0;i<vids.length;i++){
        var copy = vids[i].getElementsByClassName("copy-vid")[0];
        var id = copy.getAttribute('data-clipboard-text');
        var url= urlBase+id;
        var data= template.replace(/{{url}}/g,url);
        copy.setAttribute('data-clipboard-text',data);
    }
})();