Created
July 1, 2019 12:19
-
-
Save Bigcircle/754f2e9723bcd675d308c55cd8b9bb0b to your computer and use it in GitHub Desktop.
smzdm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name @@张大妈值率 | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description 张大妈值率 | |
// @author You | |
// @match *://*.smzdm.com/* | |
// @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js | |
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
'use strict'; | |
var log = console.log.bind(console) | |
function kanZhi(Jnode) { | |
// 隐藏众筹 | |
if (Jnode.attr("data-cid") == '7') { | |
Jnode.hide(); | |
return; | |
} | |
var c = Jnode.find(".z-highlight a").attr("onclick"); | |
if (c) { | |
// 隐藏不想查看的,自行添加 | |
var array = ["旅游出行", "女", "童", "卫浴用品", "李宁", "森马", "单反", "魅族", "粮油调味", "厨", "茶", "瑜伽", "酒", "厨房", "宠物", "化妆"] | |
array.forEach(function (item) { | |
if (c.indexOf(item) != -1) { | |
Jnode.hide(); | |
return; | |
} | |
}) | |
var zhi = Jnode.find('[data-zhi-type="1"]').text(); | |
var buzhi = Jnode.find('[data-zhi-type="-1"]').text() || 0; | |
var result = 0; | |
if (parseInt(buzhi) === 0) { | |
if (parseInt(zhi) !== 0) result = 1; | |
} else { | |
result = parseInt(zhi) / (parseInt(zhi) + parseInt(buzhi)); | |
} | |
var percent = parseFloat(result * 100).toFixed(0); | |
var percent_int = parseInt(percent); | |
// 只显示值率大于50 | |
if (percent_int > 50) { | |
Jnode.find('.feed-btn-group').prepend('<span style="margin-right:20px;color:red;font-size:28px;">' + percent + '%</span>'); | |
} else { | |
Jnode.hide(); | |
} | |
} | |
} | |
waitForKeyElements(".feed-row-wide", kanZhi); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment