Created
March 23, 2022 02:25
-
-
Save jaquer/f2110bb4c4e0d4f97c9e675be7fcdcf2 to your computer and use it in GitHub Desktop.
Quordle version of https://github.com/archy-bold/wordle-archive/tree/main/bookmarklets - Save/Load Bookmarklets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var div = document.createElement('div'); | |
div.setAttribute('id', 'inputDiv'); | |
div.setAttribute('style', 'position:absolute;top:0;right:0;bottom:0;left:0;z-index:10000;background:white;'); | |
var btnClick = "var str = window.document.getElementById('gameStateInput').value;" | |
+ "try{" | |
+ "var json = JSON.parse(atob(str));" | |
+ "if (json.daily_current_streak == null || json.daily_history == null || json.daily_max_streak == null) throw 'err';" | |
+ "window.localStorage.setItem('daily_current_streak', json.daily_current_streak);" | |
+ "window.localStorage.setItem('daily_history', json.daily_history);" | |
+ "window.localStorage.setItem('daily_max_streak', json.daily_max_streak);" | |
+ "window.location.reload()" | |
+ "}catch(err){alert('Can\\\'t read the input.')}"; | |
div.innerHTML = '<textarea id="gameStateInput" style="width:100%;height:150px;box-sizing:border-box;" placeholder="Paste your save here"></textarea><button onclick="' + btnClick + '">Restore</button>'; | |
window.document.body.appendChild(div); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){var div=document.createElement('div');div.setAttribute('id','inputDiv');div.setAttribute('style','position:absolute;top:0;right:0;bottom:0;left:0;z-index:10000;background:white;');var btnClick="var str = window.document.getElementById('gameStateInput').value;try{var json = JSON.parse(atob(str));if (json.daily_current_streak == null || json.daily_history == null || json.daily_max_streak == null) throw 'err';window.localStorage.setItem('daily_current_streak', json.daily_current_streak);window.localStorage.setItem('daily_history', json.daily_history);window.localStorage.setItem('daily_max_streak', json.daily_max_streak);window.location.reload()}catch(err){alert('Can\\\'t read the input.')}";div.innerHTML='<textarea id="gameStateInput" style="width:100%;height:150px;box-sizing:border-box;" placeholder="Paste your save here"></textarea><button onclick="'+btnClick+'">Restore</button>';window.document.body.appendChild(div)})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
var a = window.open('about:blank').document; | |
a.write('<!DOCTYPE html><html><head><title>Wordle Save</title><meta name="viewport" content="width=device-width" /></head><body></body></html>'); | |
a.close(); | |
var b = a.body.appendChild(a.createElement('pre')); | |
b.style.overflow = 'auto'; | |
b.style.whiteSpace = 'pre-wrap'; | |
b.style.wordBreak = 'break-word'; | |
b.appendChild(a.createTextNode(btoa(JSON.stringify({daily_current_streak:window.localStorage.getItem('daily_current_streak'),daily_history:window.localStorage.getItem('daily_history'),daily_max_streak:window.localStorage.getItem('daily_max_streak')})))); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
javascript:(function(){var a=window.open('about:blank').document;a.write('<!DOCTYPE html><html><head><title>Wordle Save</title><meta name="viewport" content="width=device-width" /></head><body></body></html>');a.close();var b=a.body.appendChild(a.createElement('pre'));b.style.overflow='auto';b.style.whiteSpace='pre-wrap';b.style.wordBreak='break-word';b.appendChild(a.createTextNode(btoa(JSON.stringify({daily_current_streak:window.localStorage.getItem('daily_current_streak'),daily_history:window.localStorage.getItem('daily_history'),daily_max_streak:window.localStorage.getItem('daily_max_streak')}))))})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment