$(function(){var f=window.localStorage,c=function(){return f?f.sCustUrl:$.cookie("sCustUrl")},b=function(a){if(f)f.sCustUrl=a;else $.cookie("sCustUrl",a)};if($("body#customizations").length&&window.location.search.length>1){var d=window.location.search.substring(1);$("body").css({margin:"0px","font-family":"Verdana, Helvetica, Arial, sans-serif","font-size":"12px"});var g=$("<input>").attr("type","checkbox").attr("name","enable").appendTo("body").change(function(){$(this).is(":checked")?b(d):b("")});
c()==d&&g.attr("checked","checked");$("<label>").attr("for","enable").html('Allow importing customizations from <a href="http://fogbugz.stackexchange.com" target="_blank">fogbugz.stackexchange.com</a>').appendTo("body")}if(window.location.pathname.match("^/questions/")){d=c();!d||d.length==0||$("div.post-text pre").each(function(){var a=$(this).html();a=a.replace(/<br>/g,"\n");a=a.replace(/<[\s\S]*?>/g,"");a=a.replace(/&nbsp;/g," ");a=a.replace(/&lt;/g,"<");a=a.replace(/&gt;/g,">");a=a.replace(/&amp;/g,
"&");a=a.replace(/&quot;/g,'"');if(/^name:/m.test(a)&&/^description:/m.test(a)){var e=/^name:\s*(.*?)\s*$/m.exec(a);e=e?e[1]:"Unknown";var h=$(this).css("margin","0px").text(a).wrap("<div>").parent();h.css({border:"1px solid #444","margin-bottom":"8px","box-shadow":"2px 2px 3px #888","-moz-box-shadow":"2px 2px 3px #888","-webkit-box-shadow":"2px 2px 3px #888"});h=$("<table><tr><td></td><td></td></tr></table>").css("width","99%").prependTo(h);h.find("td:first").text(e).css({padding:"2px","font-weight":"bold"});
e=h.find("td:last").css({width:"100px","max-width":"150px"});e=$("<input>").attr("type","button").css({"padding-left":"4px","padding-right":"4px",cursor:"pointer",margin:"4px"}).val("Send to my FogBugz...").appendTo(e);var i=$(this).closest("div.answer").find("div.post-menu").find("a[href^=/questions/]").attr("href")||$("#question-header a").attr("href");if(i)i=window.location.protocol+"//"+window.location.host+i;e.click(function(){var j=a,m=i,k=$("<form>").attr("method","post").attr("action",c());
j={pg:"pgPlugin",sPluginID:"BugMonkey@fogcreek.com",sView:"import",sCust:j,sUrl:m};for(var l in j)$("<textarea>").attr("name",l).val(j[l]).appendTo(k);k.submit()})}})}});
jQuery.cookie=function(f,c,b){if(arguments.length>1&&(c===null||typeof c!=="object")){b=jQuery.extend({},b);if(c===null)b.expires=-1;if(typeof b.expires==="number"){var d=b.expires,g=b.expires=new Date;g.setDate(g.getDate()+d)}return document.cookie=[encodeURIComponent(f),"=",b.raw?String(c):encodeURIComponent(String(c)),b.expires?"; expires="+b.expires.toUTCString():"",b.path?"; path="+b.path:"",b.domain?"; domain="+b.domain:"",b.secure?"; secure":""].join("")}b=c||{};g=b.raw?function(a){return a}:
decodeURIComponent;return(d=RegExp("(?:^|; )"+encodeURIComponent(f)+"=([^;]*)").exec(document.cookie))?g(d[1]):null};
