Skip to content

Instantly share code, notes, and snippets.

@gythialy
Last active January 26, 2023 14:34
Show Gist options
  • Save gythialy/4fb7c67fa8ad89aef910c5a55db2bb0d to your computer and use it in GitHub Desktop.
Save gythialy/4fb7c67fa8ad89aef910c5a55db2bb0d to your computer and use it in GitHub Desktop.
TTGBonusSignIn userscirpt
// ==UserScript==
// @name TTGBonusSignIn
// @description TTGBonusSignIn
// @namespace https://github.com/gythialy
// @match http://totheglory.im/*
// @match https://totheglory.im/*
// @version 0.3
// @grant none
// ==/UserScript==
(function () {
var signLink = $("#signed");
// console.log($('#sp_signed').text());
if (signLink && $('#sp_signed').text() === "签到") {
var ss = $("script:not([src])")
for (var index = 0, len = ss.length; index < len; ++index) {
//get the time_stamp and token for later use.
var ma = /signed_timestamp: "(\d+)", signed_token: "([\da-f]+)"/g.exec(ss[index].textContent);
if (ma) {
//console.log(ma[0]);
var siPostData = {
signed_timestamp: ma[1],
signed_token: ma[2]
};
$.post(document.location.origin + "/signed.php", siPostData, function (data) {
$('#sp_signed').html("<b style=\"color:green;\">已签到</b>");
var sp = $('<span/>').html(data);
var ap = $('a[href="/mybonus.php"]').append(sp);
//alert(data);
});
break;
}
}
}
$('span.imdb_rate > a').each(function (index, value) {
// console.log(index + '' + value.href + '->' + value.text + ':' + value.style.fontSize);
var rate = parseFloat(value.text);
if (rate >= 7) {
value.style.color = "red";
value.style.fontSize = "150%"
}
})
// highlight years
let year = new Date().getFullYear();
let years = [year, year - 1];
for (let i in years) {
$('a[href^="/t/"]:contains("' + years[i] + '")[hightlighted!=1]').each(function () {
$(this).html($(this).text().replace(years[i], '<span style="font-size: large; font-weight: bold; color: #CE00B9; ">' + years[i] + ' </span>')).attr('hightlighted', 1);
});
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment