您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
try to take over the world!
当前为
// ==UserScript== // @name Download dueling nexus decks // @namespace http://tampermonkey.net/s // @version 0.4 // @description try to take over the world! // @author You // @match https://duelingnexus.com/editor/* // @match https://duelingnexus.com/ // @grant none // ==/UserScript== //NOTE THAT ONLY SAVED DECKS CAN BE DOWNLOADED So if you are building the deck click save and refresh the page; then this code works /* * Function to download data to a file * * @param String data * @param String filename * @param String type * return void */ if (window.location.href == 'https://duelingnexus.com/'){ // Here we place an id to the buttonlayout so we can add our own buttons. $("#tab-duel-gamelist p").attr("id", "buttona").first(); // place the buttonlayout in a variable var buttonLayout = $("#buttona"); /* * begin adding things to the button layout */ /* <h3> text */ buttonLayout.append("<h3>Modded buttons</h3>"); /* button Only MR3 matches with id mr3 */ buttonLayout.append('<button id="showOnlyMR3" class="button">Only MR3 matches</button> '); /* button Only MR4 matches with id mr4 */ buttonLayout.append('<button id="showOnlyMR4" class="button">Only MR4 matches</button> '); /* add some enters e.g <br> */ buttonLayout.append("<br>"); /* button only availble matches with id availableMatches */ buttonLayout.append('<button id="showNotStartedMatches" class="button">Only not started</button> '); /* show all matches back. */ buttonLayout.append('<button id="restoreMatches" class="button">All matches visible</button> '); /* * end button layout */ /* variables */ //We need to know which buttons are selected. var mr3ButtonSelected = false; var mr4ButtonSelected = false; var notStartedMatchesButtonSelected = false; jQuery("#showOnlyMR3").click(function() { /* make only mr3 matches visible */ mr3ButtonSelected = true; /* make mr4 matches not visible */ mr4ButtonSelected = false; showOnlyMR3Matches(); }); jQuery("#showOnlyMR4").click(function() { /* make only mr4 matches visible */ mr4ButtonSelected = true; /* make mr3 matches not visible */ mr3ButtonSelected = false; showOnlyMR4Matches(); }); jQuery("#showNotStartedMatches").click(function() { notStartedMatchesButtonSelected = true; showOnlyAvailableMatches(); }); jQuery("#restoreMatches").click(function() { restoreVariables(); showAllMatches(); }); function showOnlyMR3Matches() { showMR3Matches(); hideMR4Matches(); } function showOnlyMR4Matches() { showMR4Matches(); hideMR3Matches(); } function restoreVariables(){ notStartedMatchesButtonSelected = false; buttonSelected = ""; } function showAllMatches(){ $('#lobby-duels-table tbody tr').show(); } function hideNotAvailableMatches(){ $('#lobby-duels-table tbody tr:not(:contains("---"))').hide(); } function hideMR3Matches(){ $('#lobby-duels-table tbody .duel-rules:contains("MR3")').parent().hide(); } function hideMR4Matches(){ $('#lobby-duels-table tbody .duel-rules:contains("MR4")').parent().hide(); } function showMR3Matches(){ $('#lobby-duels-table tbody .duel-rules:contains("MR3")').parent().show(); } function showMR4Matches(){ $('#lobby-duels-table tbody .duel-rules:contains("MR4")').parent().show(); } /* * because tablerows -duel matches- are kept being added to the table, we use a timer function the * timer will keep updating the table. */ function myTimer() { /* if mr3ButtonSelected is selected */ if(mr3ButtonSelected){ showOnlyMR3Matches(); if(notStartedMatchesButtonSelected){ hideNotAvailableMatches(); } } /* if mr4ButtonSelected is selected */ else if(mr4ButtonSelected){ showOnlyMR4Matches(); if(notStartedMatchesButtonSelected){ hideNotAvailableMatches(); } } /* if only not started button is selected */ else if(notStartedMatchesButtonSelected){ hideNotAvailableMatches(); } } /* * Here we start the timer do function every x amount */ setInterval(myTimer, 300); } if (window.location.href.indexOf( 'https://duelingnexus.com/editor/') > -1){ console.log('hello'); function download(data, filename, type) { var file = new Blob([data], {type: type}); if (window.navigator.msSaveOrOpenBlob) // IE10+ window.navigator.msSaveOrOpenBlob(file, filename); else { // Others var a = document.createElement("a"), url = URL.createObjectURL(file); a.href = url; a.download = filename; document.body.appendChild(a); a.click(); setTimeout(function() { document.body.removeChild(a); window.URL.revokeObjectURL(url); }, 0); } } /* * Make a text line with added \r\n so we have line breaks in notepad * * @param String value * return String */ function textLine(value){ return value + "\r\n"; } /* * Get the deckname based on the websites deckname * * return String */ function fileName(){ filename = document.getElementsByClassName("editor-deck-name")[0].innerHTML; return filename + ".ydk"; } /* * function for generating text for in text file * * @param String value * return String */ function deckString(){ //we make a string called deck var deck = ""; /* here we push the retrieved value into the deck variable */ //here we say created by no one -- can't find a way to retrieve the username deck += textLine("#created by ... "); //create main deck deck += textLine("#main"); jQuery.each( Deck.main, function( i, val ) { deck += textLine(val); }); //create extra deck deck += textLine("#extra"); jQuery.each( Deck.extra, function( i, val ) { deck += textLine(val); }); //create side deck deck += textLine("!side"); jQuery.each( Deck.side, function( i, val ) { deck += textLine(val); }); //return the string return deck; } $('#editor-menu-content').append('<button id="downloadDeck" class="engine-button engine-button-navbar engine-button-default">Download</button>'); $( "#downloadDeck" ).click(function() { download(deckString(), fileName(), ""); }); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址