By | Chris Done |
At | 2012-08-31 |
Title | username hack |
Description |
Add file wwwroot/js/amelie.js 33188
+ 1 window.jQuery(function (){var var_1 = 0;window.jQuery('.amelie-code').each(function (){var_1 = Math.max(500,Math.max(window.jQuery(this).width() + 50,var_1));return true;});window.jQuery('.amelie-code').each(function (){window.jQuery('.amelie-wrap').width(Math.max(var_1,500));return true;});window.jQuery('.amelie-latest-pastes').each(function (){window.jQuery('.amelie-wrap').width(Math.max(window.jQuery(this).width(),500));return true;});window.jQuery('.amelie-hint').each(function (){var var_6 = window.jQuery(this);var_6.css('height','1em');var_6.css('overflow','hidden');var_6.parent().css('cursor','pointer');var_6.parent().toggle(function (){var_6.css('height','auto');return false;},function (){var_6.css('height','1em');var_6.css('overflow','hidden');return false;});return true;});window.jQuery('.amelie-paste-nav').each(function (){var var_10 = window.jQuery('<a href="">Expand</a>');var var_11 = window.jQuery(this);var_11.prepend(' - ');var_11.prepend(var_10);var var_12 = var_11.siblings('.amelie-paste-specs');var_12.css('display','none');var_10.text('Expand');var_10.toggle(function (){var_12.css('display','block');var_10.text('Collapse');return false;},function (){var_12.css('display','none');var_10.text('Expand');return false;});return true;});}); + 2 + 3 + 4 /*jshint eqnull:true */ + 5 /*! + 6 * jQuery Cookie Plugin v1.1 + 7 * https://github.com/carhartl/jquery-cookie + 8 * + 9 * Copyright 2011, Klaus Hartl + 10 * Dual licensed under the MIT or GPL Version 2 licenses. + 11 * http://www.opensource.org/licenses/mit-license.php + 12 * http://www.opensource.org/licenses/GPL-2.0 + 13 */ + 14 (function($, document) { + 15 + 16 var pluses = /\+/g; + 17 function raw(s) { + 18 return s; + 19 } + 20 function decoded(s) { + 21 return decodeURIComponent(s.replace(pluses, ' ')); + 22 } + 23 + 24 $.cookie = function(key, value, options) { + 25 + 26 // key and at least value given, set cookie... + 27 if (arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(value)) || value == null)) { + 28 options = $.extend({}, $.cookie.defaults, options); + 29 + 30 if (value == null) { + 31 options.expires = -1; + 32 } + 33 + 34 if (typeof options.expires === 'number') { + 35 var days = options.expires, t = options.expires = new Date(); + 36 t.setDate(t.getDate() + days); + 37 } + 38 + 39 value = String(value); + 40 + 41 return (document.cookie = [ + 42 encodeURIComponent(key), '=', options.raw ? value : encodeURIComponent(value), + 43 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE + 44 options.path ? '; path=' + options.path : '', + 45 options.domain ? '; domain=' + options.domain : '', + 46 options.secure ? '; secure' : '' + 47 ].join('')); + 48 } + 49 + 50 // key and possibly options given, get cookie... + 51 options = value || $.cookie.defaults || {}; + 52 var decode = options.raw ? raw : decoded; + 53 var cookies = document.cookie.split('; '); + 54 for (var i = 0, parts; (parts = cookies[i] && cookies[i].split('=')); i++) { + 55 if (decode(parts.shift()) === key) { + 56 return decode(parts.join('=')); + 57 } + 58 } + 59 return null; + 60 }; + 61 + 62 $.cookie.defaults = {}; + 63 + 64 })(jQuery, document); + 65 + 66 $(document).ready(function(){ + 67 $('form').each(function(){ + 68 $(this).find('input[name=author]') + 69 .val($.cookie('author')) + 70 .change(function(){ + 71 $.cookie('author', $(this).val(), { expires: 365, path: '/' }); + 72 }); + 73 }); + 74 });