您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
backpack script 刷成交量脚本,支持手动开启关闭,设置买入卖出点
当前为
// ==UserScript== // @name backpack tool // @namespace https://github.com/zhowiny // @version 0.0.1 // @author zhowiny // @description backpack script 刷成交量脚本,支持手动开启关闭,设置买入卖出点 // @icon https://backpack.exchange/favicon-32x32.png // @match https://backpack.exchange/trade/* // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.global.prod.js // @require data:application/javascript,%3Bwindow.Vue%3DVue%3B // @grant GM_addStyle // ==/UserScript== (t=>{if(typeof GM_addStyle=="function"){GM_addStyle(t);return}const e=document.createElement("style");e.textContent=t,document.head.append(e)})(' *,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }.fixed{position:fixed}.mt-4{margin-top:1rem}.flex{display:flex}.grid{display:grid}.h-12{height:3rem}.h-2{height:.5rem}.h-full{height:100%}.w-12{width:3rem}.flex-1{flex:1 1 0%}.snap-mandatory{--tw-scroll-snap-strictness: mandatory}.flex-col{flex-direction:column}.gap-2{gap:.5rem}.self-center{align-self:center}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.border{border-width:1px}.border-t{border-top-width:1px}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-black\\/25{background-color:#00000040}.p-2{padding:.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pt-2{padding-top:.5rem}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji"}.text-sm{font-size:.875rem;line-height:1.25rem}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.opacity-10{opacity:.1}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)} '); (function (vue) { 'use strict'; const ee={class:"backpack-tool grid gap-2 text-sm text-white bg-base-700 p-2 rounded",style:{"grid-template-areas":"'a a . .' 'a a . .' 'a a . .' 'a a . .' 'b b b b' '. . . .'"}},te=vue.createElementVNode("span",null,"限价:",-1),ne=["disabled"],ae=vue.createElementVNode("span",null,"市场:",-1),le=["disabled"],oe=["disabled"],re=["disabled"],ie=vue.createElementVNode("span",null,"超时时间(秒):",-1),se=["disabled"],ue=vue.createElementVNode("p",{class:"mt-4 px-2 pt-2 border-t",style:{"grid-area":"b"}},[vue.createTextVNode(" 超时时间:超时自动取消订单,"),vue.createElementVNode("code",null,"0"),vue.createTextVNode("为不取消! ")],-1),ce={style:{color:"#afa"}},de={style:{color:"#faf"}},me={style:{color:"#ffa"}},$=300,q=1e3,V=500,P=2e3,pe={__name:"BackpackTool",setup(c){const w={Limit:"限制",Market:"市场",Max:"最大",Buy:"购买",Sell:"出售",Cancel:"取消"},s=t=>new Promise(e=>setTimeout(e,t)),f=(t,e)=>Math.floor(Math.random()*e+t);function y(t,e,n=document){const u=n.querySelectorAll(`${e}:not(:empty):not(:has(*))`);return Array.from(u).filter(r=>r.textContent===t||r.textContent===w[t])}function C(t,e){let n=y(t,e)[0];if(!(!n&&(n=y(w[t]||t,e)[0],!n)))return n}async function _(t,e){const n=C(t,e);!n||!window.running||(n.click(),await s(f($,q)));}function D(){return document.querySelector(".flex.flex-col.no-scrollbar.h-full.flex-1.snap-mandatory.overflow-y-auto.font-sans")}function k(t,e){const n=t==="Buy";return D().querySelector(`& > div:${n?"last":"first"}-child > div > div:nth-child(${e}) button div`)}async function W(t,e){const n=k(t,e);n.classList.add("border"),n.click(),await s(300);}let T=0,M=0,h=0;async function X(t){const e=C(t,"button");e&&(e.addEventListener("click",()=>{t==="Buy"?(T++,console.log(`%c第${T}次买入`,"color: #afa;")):(M++,console.log(`%c第${M}次卖出`,"color: #faf;"));},{once:!0}),e.click(),await s(f($,q)));}async function E(t,e){if(!window.running)return console.log("已暂停");await _(t,"p"),await _(e.mode||"Limit","div"),await W(t,e[t]),await _("Max","div"),await X(t);}async function z(t){try{await E("Buy",t),await s(f(V,P)),await E("Sell",t),await s(f(V,P));}catch(e){console.error("发生错误:",e);}}const x=new Map;function F(t){t.forEach(e=>{const n=x.get(e.orderText);n&&Date.now()>n&&(e.cancel(),x.delete(e.orderText),h++,console.log(`%c订单【${e.orderText}】超时未成交,已取消!订单取消次数:${h}`,"color: #ffa;"));});}function A(){const e=y("My Assets","div")[0].parentElement.parentElement;return {openOrderTab:e.children[0],tabsElement:e}}const H=t=>t.parentElement.nextElementSibling.querySelector("tbody");function R(t){const e=H(A().tabsElement),{timeout:n=0}=t;return [...(e==null?void 0:e.children)??[]].reduce((u,r)=>{const i=r.textContent;if(i.includes("No open Orders"))return [];const j={orderText:i,ele:r,cancel:()=>y("Cancel","p",r)[0].click(),data:r.textContent.split(` `).filter(K=>K)};u.push(j);const J=n?x.get(i)||Date.now()+n*1e3:0;return x.set(i,J),u},[])}const o=vue.ref(!1),l=vue.ref({Buy:2,Sell:2,timeout:0,mode:"Market"}),d=vue.ref({buy:0,sell:0,cancel:0}),I=vue.ref([]);function S(t,e,n={min:1,max:20}){const{min:u,max:r}=n;let i=Number.parseInt(t.target.value);i>r&&(i=r),(i<u||Number.isNaN(i))&&(i=u),l.value[e]=Math.max(u,Math.min(r,i));}async function L(){await z(l.value),d.value.buy=T,d.value.sell=M,await s(3e3),o.value&&window.requestAnimationFrame(()=>L());}async function N(){const{openOrderTab:t}=A();t.click(),await s(300);const e=R(l.value);I.value=e,F(e),d.value.cancel=h,await s(2e3),o.value&&window.requestAnimationFrame(()=>N());}async function G(){window.running=o.value=!o.value,console.log(o.value?"start":"stop"),o.value&&await L(),o.value&&await N(),!o.value&&k("Buy",l.value.Buy).classList.remove("border"),!o.value&&k("Sell",l.value.Sell).classList.remove("border");}return (t,e)=>(vue.openBlock(),vue.createElementBlock("div",ee,[vue.createElementVNode("button",{class:vue.normalizeClass(["bg-greenText rounded p-2 h-12 self-center",{"bg-redText":o.value}]),style:{"grid-area":"a"},onClick:G},vue.toDisplayString(o.value?"脚本运行中,点击关闭交易":"启动脚本,点击开始交易"),3),vue.createElementVNode("label",null,[te,vue.withDirectives(vue.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=n=>l.value.mode=n),type:"radio",value:"Limit",disabled:o.value},null,8,ne),[[vue.vModelRadio,l.value.mode]])]),vue.createElementVNode("label",null,[ae,vue.withDirectives(vue.createElementVNode("input",{"onUpdate:modelValue":e[1]||(e[1]=n=>l.value.mode=n),type:"radio",value:"Market",disabled:o.value},null,8,le),[[vue.vModelRadio,l.value.mode]])]),vue.createElementVNode("span",{class:vue.normalizeClass({"opacity-10":l.value.mode==="Market"})},"第几个买入:",2),vue.withDirectives(vue.createElementVNode("input",{"onUpdate:modelValue":e[2]||(e[2]=n=>l.value.Buy=n),class:vue.normalizeClass(["w-12 h-2 py-2 text-center bg-black text-greenText",{"bg-black/25":o.value,"opacity-10":l.value.mode==="Market"}]),type:"number",min:1,max:20,step:1,disabled:o.value||l.value.mode==="Market",onInput:e[3]||(e[3]=n=>S(n,"Buy"))},null,42,oe),[[vue.vModelText,l.value.Buy,void 0,{number:!0}]]),vue.createElementVNode("span",{class:vue.normalizeClass({"opacity-10":l.value.mode==="Market"})},"第几个卖出:",2),vue.withDirectives(vue.createElementVNode("input",{"onUpdate:modelValue":e[4]||(e[4]=n=>l.value.Sell=n),class:vue.normalizeClass(["w-12 h-2 py-2 text-center bg-black text-redText",{"bg-black/25":o.value,"opacity-10":l.value.mode==="Market"}]),type:"number",min:1,max:20,step:1,disabled:o.value||l.value.mode==="Market",onInput:e[5]||(e[5]=n=>S(n,"Sell"))},null,42,re),[[vue.vModelText,l.value.Sell,void 0,{number:!0}]]),ie,vue.withDirectives(vue.createElementVNode("input",{"onUpdate:modelValue":e[6]||(e[6]=n=>l.value.timeout=n),class:vue.normalizeClass(["w-12 h-2 py-2 text-center bg-black text-accentBlue",{"bg-black/25":o.value}]),type:"number",min:0,max:600,step:1,disabled:o.value,onInput:e[7]||(e[7]=n=>S(n,"timeout",{min:0,max:600}))},null,42,se),[[vue.vModelText,l.value.timeout,void 0,{number:!0}]]),ue,vue.createElementVNode("div",null,"当前订单数:"+vue.toDisplayString(I.value.length),1),vue.createElementVNode("div",null,[vue.createTextVNode("买入次数:"),vue.createElementVNode("span",ce,vue.toDisplayString(d.value.buy),1)]),vue.createElementVNode("div",null,[vue.createTextVNode("卖出次数:"),vue.createElementVNode("span",de,vue.toDisplayString(d.value.sell),1)]),vue.createElementVNode("div",null,[vue.createTextVNode("取消次数:"),vue.createElementVNode("span",me,vue.toDisplayString(d.value.cancel),1)])]))}},ve={__name:"App",setup(c){return (w,s)=>(vue.openBlock(),vue.createBlock(pe))}},be="tampermonkey_vue_app".toUpperCase();vue.createApp(ve).mount((()=>{const c=document.createElement("div");return c.id=be,c.style.cssText="position: fixed;top: 10px;left:50%;z-index:1000;transform: translateX(-50%);",document.body.append(c),c})()); })(Vue);
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址