您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Removes current day's hits from the DB to prepare it for the new update
当前为
// ==UserScript== // @name MTurk HIT DataBase Patch v1 // @namespace https://greasyforks.org/users/710 // @description Removes current day's hits from the DB to prepare it for the new update // @include https://www.mturk.com/mturk/dashboard // @version 2 // @grant none // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js // ==/UserScript== var HITStorage = {}; var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB; window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.mozIDBTransaction; window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.mozIDBKeyRange; HITStorage.IDBTransactionModes = { "READ_ONLY": "readonly", "READ_WRITE": "readwrite", "VERSION_CHANGE": "versionchange" }; var IDBKeyRange = window.IDBKeyRange; HITStorage.indexedDB = {}; HITStorage.indexedDB = {}; HITStorage.indexedDB.db = null; HITStorage.indexedDB.onerror = function(e) { console.log(e); }; var v = 4; if (confirm("This will delete all hits done from your DB for 2015-06-02.")) { var request = indexedDB.open("HITDB", 4); request.onsuccess = function(e) { HITStorage.indexedDB.db = e.target.result; var db = HITStorage.indexedDB.db; var trans = db.transaction(["HIT"], HITStorage.IDBTransactionModes.READ_WRITE); var store = trans.objectStore("HIT"); store.openCursor().onsuccess = function(event) { var cursor = event.target.result; if (cursor) { if (cursor.value.date == "2015-06-02") { console.log("Deleting "+cursor.value); cursor.delete(); } cursor.continue(); } else { db.close(); } }; trans = db.transaction(["STATS"], HITStorage.IDBTransactionModes.READ_WRITE); store = trans.objectStore("STATS"); store.openCursor().onsuccess = function(event) { var cursor = event.target.result; console.log(cursor); if (cursor) { if (cursor.value.date == "2015-06-02") { console.log("Deleting "+cursor.value); cursor.delete(); } cursor.continue(); } else { db.close(); } }; } } alert("Done");