Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Decoder Script
- * By: BlazePh
- */
- // Get original phrase
- var original = document.body.innerHTML;
- original = original.replace("<pre>", "");
- original = original.replace("</pre>", "");
- var final = "";
- // Split into lines
- original = original.split(/\r\n|\r|\n/);
- for (var i = 0; i < original.length; i++)
- {
- var line = original[i];
- // Ignore blank lines
- if (line != null && line != "")
- {
- // Insert newline
- if (i != 0)
- final += "<br />";
- // Split line into words
- line = line.split(" ");
- var j, reverse;
- // If line begins with a quote, it's normal
- if (line[0].charAt(0) == '"')
- {
- reverse = false;
- j = 0;
- }
- // Otherwise, it's in reverse
- else
- {
- reverse = true;
- j = line.length - 1;
- }
- while (j >= 0 && j < line.length)
- {
- var word = line[j];
- // Ignore "blank" words
- if (word != null && word != "")
- {
- // Insert space
- if ((reverse && j != (line.length - 1)) || (!reverse && j != 0))
- final += " ";
- // Check for quotes and commas
- var quoteBegin = (word.indexOf("\"") == 0);
- var quoteEnd = (word.indexOf("\"") == (word.length - 1));
- var comma = (word.indexOf(",") != -1);
- // Insert begin quote if necessary
- if (quoteBegin)
- {
- word = word.substr(1);
- final += "\"";
- }
- if (quoteEnd || comma)
- word = word.substr(0, (word.length - 1));
- // Split word into letters
- word = word.split("/");
- // Convert each character code into its corresponding
- // letter and insert it
- for (var k = 0; k < word.length; k++)
- {
- var letterCode = new Number(word[k]);
- final += String.fromCharCode(91 - letterCode);
- }
- // Insert end quote if necessary
- if (quoteEnd)
- final += "\"";
- // Insert comma if necessary
- if (comma)
- final += ",";
- }
- if (reverse)
- j--;
- else
- j++;
- }
- }
- }
- document.body.innerHTML += final;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement