text: ﻿(function($){var e={init:function(){var d=this;d.settings=$.extend({'ShiftId':'shift','MessageId':'message','ResultsId':'results','AllResultsId':'all-results','EncyrptButtonId':'encrypt'},{'ShiftId':d.attr("data-ShiftId"),'MessageId':d.attr("data-MessageId"),'ResultsId':d.attr("data-ResultId"),'AllResultsId':d.attr("data-AllResultsId"),'EncyrptButtonId':d.attr("data-EncyrptButtonId")});d.$Shift=$('#'+d.settings.ShiftId);d.$Message=$('#'+d.settings.MessageId);d.Results=$('#'+d.settings.ResultId);d.AllResults=$('#'+d.settings.AllResultsId);d.EncyrptButton=$('#'+d.settings.EncyrptButtonId);d.CaesarCipher=function(a,b){var c="";for(var i=0;i<b.length;i++)c+=String.fromCharCode(Math.abs((b.charCodeAt(i)-65+a)%26)+65);return c}d.PreCondition=function(a){a=a.toUpperCase();a=a.replace(/ /g,"");a=a.replace(/[^A-Z]+/g,"");return a}d.EncyrptButton.click(function(){d.$Message.val(d.PreCondition(d.$Message.val()));$('#results').html(d.CaesarCipher(d.$Shift.val(),d.$Message.val()));var a="<ul style='list-style: none'>\n\r";for(var i=1;i<27;i++)a+="<li><strong>"+i+"</strong> &mdash; "+d.CaesarCipher(i,d.$Message.val())+"</li>\n\r";a+="</ul>\n\r";$('#all-results').html(a)});return d}};$.fn.tbaCaesarCipher=function(a){if(e[a]){return e[a].apply(this,Array.prototype.slice.call(arguments,1))}else if(typeof a==='object'||!a){return e.init.apply(this,arguments)}else{$.error('Method '+a+' does not exist on jQuery.tbaCaesarCipher')}}})(jQuery);tba=Object();$(document).ready(function(){tba.Tree=$('#caesar-cipher').tbaCaesarCipher()});