Clear BLOCK table in HITDB

Completely empty the BLOCK table in HITDB

  1. // ==UserScript==
  2. // @name Clear BLOCK table in HITDB
  3. // @namespace localhost
  4. // @description Completely empty the BLOCK table in HITDB
  5. // @include https://www.mturk.com/mturk/dashboard
  6. // @require http://code.jquery.com/jquery-2.1.1.js
  7. // @version 1.0.1
  8. // @grant none
  9. // ==/UserScript==
  10. var HITStorage = {};
  11. var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB;
  12. window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.mozIDBTransaction;
  13. window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.mozIDBKeyRange;
  14.  
  15. var IDBKeyRange = window.IDBKeyRange;
  16.  
  17. HITStorage.indexedDB = {};
  18. HITStorage.indexedDB = {};
  19. HITStorage.indexedDB.db = null;
  20.  
  21. HITStorage.indexedDB.onerror = function(e) {
  22. console.log(e);
  23. };
  24. var v = 4;
  25.  
  26. HITStorage.indexedDB.deleteBLOCKS = function () {
  27. var request = indexedDB.open("HITDB", v);
  28. console.log("request starting");
  29. request.onsuccess = function(e) {
  30. HITStorage.indexedDB.db = e.target.result;
  31. var db = HITStorage.indexedDB.db;
  32. var trans = db.transaction(["BLOCKS"], "readwrite");
  33. var clearRequest = trans.objectStore("BLOCKS").clear();
  34. clearRequest.onsuccess = function (e) {
  35. alert("BLOCKS deleted!");
  36. }
  37. }
  38. }
  39.  
  40. $('body').append("<button id='deleteBlocks' >Delete Blocks</button>");
  41.  
  42. $(document).on('click', '#deleteBlocks', function () {
  43. console.log("Deleting blocks");
  44. HITStorage.indexedDB.deleteBLOCKS();
  45. });

QingJ © 2025

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