随机价格

一定程度上防止稿件盗用

目前为 2017-08-03 提交的版本。查看 最新版本

// ==UserScript==
// allow pasting
// @name        随机价格
// @namespace   zb
// @include     http://*/zb/zb_users/plugin/appcentre/plugin_edit.asp*
// @include     http://*/zbp/zb_users/plugin/AppCentre/plugin_edit.php*
// @include     http://*/zbp/zb_users/plugin/AppCentre/theme_edit.php*
// @version     1
// @grant       none
// @description 一定程度上防止稿件盗用
// ==/UserScript==
(function () {
	var sCookiName = document.getElementById("app_id").value;
  if (sCookiName == ""){
    document.getElementById("app_url").value = "https://app.zblogcn.com/?auth=80";
    document.getElementById("app_author_name").value = "沉冰浮水";
    document.getElementById("app_author_email").value = "[email protected]";
    document.getElementById("app_author_url").value = "http://www.wdssmq.com";
    document.getElementById("app_description").value = "置百丈玄冰而崩裂,掷须臾池水而漂摇。";
  }
	if (!/xnxf_aff|xnxf_geetest|xnxf_yunfile_p|xnxf_sina|xnxf_cache|Download_p|ShotMe|Download/.test(sCookiName)) {
		sCookiName = "xnxf";
	}
	var pubdate = new Date(Date.parse(document.getElementById('app_pubdate').value.replace(/-/g, '/')));
	var modified = new Date();
  console.log((modified - pubdate) % 5);
  if (diff() && document.getElementById("app_price").value === "0") {
    modified.setDate(modified.getDate() - 73 - ((modified - pubdate) % 23) * 13);
  }
  document.getElementById('app_modified').value = modified.toLocaleString().replace(/\//g, '-').replace(/ (下午|上午).+$/g, '');
	function diff() {
		if (parseInt((modified - pubdate) / (1000 * 60 * 60 * 24)) > 431) {
			return true;
		} else {
			return false;
		}
	}
	var arrPrimes = [[17,
			19,
			23,
			29,
			31,
			37,
			41], [59,
			61,
			67,
			71,
			73,
			79,
			83]];
	var arr = [
	];
	var min = 1;
	var max = 7;
	var mid = (min + max) / 2;
	for (var i = min; i <= max; i++) {
		var end = i < mid ? i : mid * 2 - i;
		for (var j = 1; j <= end; j++) {
			arr.push(i);
		}
	}

	var t = 0;
	for (var i = min; i < max + 1; i++) {
		var n = "--";
		var m = 0;
		for (var x in arr) {
			if (arr[x] == i) {
				n = n + arr[x] + ",";
				m++;
			};
		}
		console.log(m + n);
		t = t + m;
	}
	console.log(t);
	function randomsort(a, b) {
		return Math.random() > 0.5 ?  - 1 : 1;
	}
	function fnRndItem(a) {
		a = a.sort(randomsort);
		arr = arr.sort(randomsort);
		index = parseInt(arr[parseInt((arr.length) * Math.random())]);
		return a[0][index - 1];
	}
	function fnTimeDiff() {
		oPubDate = new Date(Date.parse(document.getElementById("app_pubdate").value.replace(/-/g, "/")));
		oUpDate = new Date(Date.parse(document.getElementById("app_modified").value.replace(/-/g, "/")));
		return parseInt((oUpDate - oPubDate) / (1000 * 60 * 60 * 24));
	}
	var x = fnTimeDiff() / 59;
	console.log(x);

	var fNewPrice = (x / 17) * (1 - x / 17) * fnRndItem(arrPrimes) + fnRndItem(arrPrimes);
	console.log(fNewPrice);
	// for(var i = 0; i<1000;i++){

	// }
	if (typeof zbp != "undefined") {
		GetCookie = zbp.cookie.get;
		SetCookie = zbp.cookie.set;
	}
  document.getElementById("app_version").value = (x / 10).toFixed(1);
	if (sCookiName !== "xnxf") {
		$("#btnPost").click(function () {
			if (!!GetCookie(sCookiName) && document.getElementById("app_version").value != 65537)
				return;
			SetCookie(sCookiName, 1, 1);
			document.getElementById("app_price").value = fNewPrice.toFixed(2);
		});
	}
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址