Created
January 24, 2013 04:23
-
-
Save roine/4617620 to your computer and use it in GitHub Desktop.
This file contains hidden or 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(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.8.3",function($,L){$('form').submit(function () {if($(".jon-submit:checkbox").is(":checked")){return;}var $that = $(this),formWidth = $(this).width(),checkbox = $(document.createElement('input')).prop('type', 'checkbox').addClass('jon-submit').css({'width': 22,'float': 'none','height': 17,margin:0,padding:0,'font-size':12}),checkboxWrapper = $(document.createElement('div')).append(checkbox).append("Submit form").css({'background':'white','width': formWidth,'z-index':2000,'padding':'2px 10px','margin':'2px 0','border-radius':3,'border':'1px solid silver','text-align':'center','box-shadow': '0 0 5px rgba(0,0,0,.5)','position':'relative','font-size': 14}),arSerialized = $(this).serializeArray(),cleanSerialized = "",i,entry,size = arSerialized.length;for ( i = 0; i < size; ++i) {entry = arSerialized[i];cleanSerialized += entry.name+": "+entry.value+"<br>";}if ($('.serialized').length < 1){$(this).after("<div class='serialized' style='text-shadow:0 1px gainsboro;font-size:14px;color:rgb(75, 75, 75);position:relative;background:white;z-index:2000;width: "+formWidth+"px;height:auto;display: block;-webkit-hyphens: auto;word-break: break-all;padding: 10px;border: 1px solid grey;border-radius: 3px;box-shadow: 0 0 5px rgba(0,0,0,.5);'>" + cleanSerialized + "</div>");}$('.serialized').html(cleanSerialized);if($('.jon-submit').length < 1){$('.serialized').before(checkboxWrapper);}return false;});}); |
This file contains hidden or 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
| $('form').submit(function () { | |
| if($(".jon-submit:checkbox").is(":checked")){ | |
| return; | |
| } | |
| var $that = $(this), | |
| formWidth = $(this).width(), | |
| checkbox = $(document.createElement('input')) | |
| .prop('type', 'checkbox') | |
| .addClass('jon-submit') | |
| .css({'width': 22, | |
| 'float': 'none', | |
| 'height': 17, | |
| margin:0, | |
| padding:0, | |
| 'font-size':12 | |
| }), | |
| checkboxWrapper = $(document.createElement('div')) | |
| .append(checkbox) | |
| .append("Submit form") | |
| .css({ | |
| 'background':'white', | |
| 'width': formWidth, | |
| 'z-index':2000, | |
| 'padding':'2px 10px', | |
| 'margin':'2px 0', | |
| 'border-radius':3, | |
| 'border':'1px solid silver', | |
| 'text-align':'center', | |
| 'box-shadow': '0 0 5px rgba(0,0,0,.5)', | |
| 'position':'relative', | |
| 'font-size': 14 | |
| }), | |
| arSerialized = $(this).serializeArray(), | |
| cleanSerialized = "", | |
| i, | |
| entry, | |
| size = arSerialized.length; | |
| for ( i = 0; i < size; ++i) { | |
| entry = arSerialized[i]; | |
| cleanSerialized += entry.name+": "+entry.value+"<br>"; | |
| } | |
| if ($('.serialized').length < 1){ | |
| $(this).after("<div class='serialized' style='text-shadow:0 1px gainsboro;font-size:14px;color:rgb(75, 75, 75);position:relative;background:white;z-index:2000;width: "+formWidth+"px;height:auto;display: block;-webkit-hyphens: auto;word-break: break-all;padding: 10px;border: 1px solid grey;border-radius: 3px;box-shadow: 0 0 5px rgba(0,0,0,.5);'>" + cleanSerialized + "</div>"); | |
| } | |
| $('.serialized').html(cleanSerialized); | |
| if($('.jon-submit').length < 1){ | |
| $('.serialized').before(checkboxWrapper); | |
| } | |
| return false; | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment