ccyycn get keys

scrape your keys

目前為 2017-07-10 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         ccyycn get keys
// @namespace  none
// @version      0.2
// @description  scrape your keys
// @author       You
// @match        http://bundle.ccyycn.com/order/id/*
// @grant        GM_addStyle
// ==/UserScript==

GM_addStyle(".operation a{color:#fff;text-decoration: none;} .operation a:focus, .operation a:hover{color:#ccc;}");
(function() {
	'use strict';
	let key = [];
	let getKey = '<a class="defaultCopy" href="javascript:;">一键刮Key</a> | <a class="defaultCopy" href="javascript:;">复制所有Key(普通)</a> | <a class="defaultCopy" href="javascript:;">复制所有Key(ASF)</a><input class="keys" type="text" value="" style="opacity: 0;position: absolute;top: 0;left: 0;">';
	let el = document.createElement('div');
	el.className='operation';
	el.innerHTML = getKey;
	let ots = document.querySelector('.showkey-box');
	let after = document.querySelector('h2');
	ots.insertBefore(el,after.nextSibling);
    document.querySelectorAll('.container .deliver-game .deliver-gkey').forEach(function(e){
    	let scrape = e.querySelector('.deliver-btn');
        if(scrape){
            scrape.click();
        }
        key.push(e.innerText.replace(/\s+/g,""));
    });
	document.querySelector('.showkey-box').querySelector(".defaultCopy").addEventListener("click", function(){
		key = key.join(',');
		let copy = document.querySelector('.showkey-box').querySelector('.keys');
		copy.value = key;
		copy.select();
		try{
			document.execCommand('copy');
			alert('复制成功');
		}catch(e){
	}
   });
    // Your code here...
})();