1// Generated by CoffeeScript 1.6.3 2(function() { 3 window.usernoise = {}; 4 5 jQuery(function($) { 6 var Errors, FeedbackForm, ThankYouScreen, UsernoiseButton, UsernoiseWindow, browser; 7 UsernoiseButton = function() { 8 var self; 9 self = this; 10 self.show = function() { 11 var $button, propOnIn, propOnOut, propOnStart, property; 12 $button = $("<a href=\"#\" id=\"un-button\" />").appendTo($("body")); 13 property = void 0; 14 $button.html(usernoiseButton.text); 15 $button.addClass(usernoiseButton["class"]); 16 $button.attr("style", usernoiseButton.style); 17 $button.click(function(event) { 18 self.showWindow(); 19 event.preventDefault(); 20 return false; 21 }); 22 if (browser.msie7) { 23 if ($button.is(".un-left") || $button.is(".un-right")) { 24 $button.css("margin-top", "-" + $button.width() / 2 + "px"); 25 } 26 $button.addClass("ie7"); 27 } else if (browser.msie8) { 28 if ($button.is(".un-right")) { 29 $button.css("right", "-" + $button.outerWidth() + "px"); 30 } 31 if ($button.is(".un-left") || $button.is(".un-right")) { 32 $button.css("margin-top", "-" + $button.width() / 2 + "px"); 33 } 34 $button.addClass("ie8"); 35 } else { 36 $button.addClass("css3"); 37 } 38 if ($button.is(".un-bottom") || $button.is(".un-top")) { 39 $button.css("margin-left", "-" + ($("#un-button").width() / 2) + "px"); 40 } 41 if ($button.is(".un-left")) { 42 property = "left"; 43 } else if ($button.is(".un-right")) { 44 property = "right"; 45 } else if ($button.is(".un-bottom")) { 46 property = "bottom"; 47 } else { 48 property = "top"; 49 } 50 if ($button.is(".un-left.css3")) { 51 $button.css("margin-top", ($button.width() / 2) + "px"); 52 } 53 if ($button.is(".un-right.css3")) { 54 $button.css("margin-top", "-" + ($button.width() / 2) + "px"); 55 } 56 propOnStart = {}; 57 propOnIn = { 58 opacity: 1 59 }; 60 propOnOut = { 61 opacity: 0.96 62 }; 63 propOnStart[property] = "+=40px"; 64 propOnIn[property] = "+=3px"; 65 propOnOut[property] = "-=3px"; 66 $button.animate(propOnStart).hover((function() { 67 $button.animate(propOnIn, 100); 68 }), function() { 69 $button.animate(propOnOut, 100); 70 }); 71 }; 72 self.showWindow = function() { 73 var $iframe, $loading, $overlay; 74 $overlay = $("<div id=\"un-overlay\" />").prependTo($("body")); 75 $overlay.fadeIn("fast"); 76 $loading = $("<div id=\"un-loading\" />").prependTo($("body")); 77 $iframe = $("<iframe id=\"un-iframe\" marginheight=\"0\" marginwidth=\"0\" frameborder=\"0\" allowtransparency=\"true\" />").prependTo($("body")); 78 $iframe.css("opacity", 0); 79 $iframe.load(function() { 80 $loading.fadeOut("fast", function() { 81 $loading.remove(); 82 }); 83 $iframe.css("opacity", 0); 84 $iframe.animate({ 85 opacity: 1 86 }, "fast"); 87 }); 88 $iframe.attr("src", usernoiseButton.windowUrl); 89 }; 90 self.hideWindow = function() { 91 $("#un-overlay").fadeOut(function() { 92 $("#un-overlay").remove(); 93 }); 94 $("#un-loading").remove(); 95 $("#un-iframe").fadeOut("fast", function() { 96 $("#un-iframe").remove(); 97 }); 98 }; 99 }; 100 FeedbackForm = function($form) { 101 var selectTypeHandler, self, submitHandler; 102 selectTypeHandler = function() { 103 var $selector, type; 104 $selector = $(this).parent(); 105 $selector.find("a").removeClass("selected"); 106 $(this).addClass("selected"); 107 type = $(this).attr("data-type"); 108 $selector.find("input[type=hidden]").val(type); 109 $(document).trigger("typeselected#feedbackform#window.un", type); 110 return false; 111 }; 112 submitHandler = function() { 113 var data; 114 data = $form.unSerializeObject(); 115 if (window.parent.document) { 116 data.referer = window.parent.document.location.href; 117 } 118 $(document).trigger("submitting#feedbackform#window.un", data); 119 self.lock(); 120 $form.find(".loader").show(); 121 self.errors.hide(); 122 $.post($form.attr("action"), data, function(response) { 123 $form.find(".loader").hide(); 124 self.unlock(); 125 response = usernoise.helpers.parseJSON(response); 126 if (response.success) { 127 $("#un-thankyou").height($("#un-feedback-wrapper").height() + "px"); 128 $form.find("textarea").val("").trigger("blur"); 129 $(document).trigger("sent#feedbackform#window.un"); 130 } else { 131 self.errors.show(response.errors); 132 } 133 }); 134 return false;
135 }; 136 self = this; 137 self.form = $form; 138 $form.find(".text").unAutoPlaceholder(); 139 $form.find(".un-types-wrapper a").click(selectTypeHandler); 140 $form.find(".un-types-wrapper a:first-child").click(); 141 $form.submit(submitHandler); 142 $.extend(self, { 143 unlock: function() { 144 $(document).trigger("unlocking#feedbackform#window.un"); 145 $form.find("input, select, textarea").removeAttr("disabled"); 146 $form.find(".un-types-wrapper a").click(selectTypeHandler); 147 }, 148 lock: function() { 149 $form.find("*").unbind("click"); 150 $(document).trigger("locking#feedbackform#window.un"); 151 $form.find("input, select, textarea").attr("disabled", "disabled"); 152 }, 153 errors: new Errors($form.find(".un-feedback-errors-wrapper")), 154 selectedType: function() { 155 var type; 156 type = $("#types-wrapper a.selected").attr("id"); 157 if (type) { 158 return type.replace("un-type-", ""); 159 } else { 160 return null; 161 } 162 } 163 }); 164 $(document).trigger("created#feedbackform#window.un", self); 165 }; 166 Errors = function($errorsWrapper) { 167 var $errors, self; 168 self = this; 169 $errors = $errorsWrapper.find(".un-errors"); 170 $.extend(self, { 171 show: function(errors) { 172 $("#window").addClass("transitionEnabled"); 173 $(errors).each(function(index, error) { 174 $errors.append($("<p />").text(error)); 175 }); 176 $errorsWrapper.fadeIn("fast"); 177 }, 178 hide: function(errors) { 179 $errors.html(""); 180 $errorsWrapper.fadeOut("fast", function() { 181 $errorsWrapper.hide(); 182 }); 183 } 184 }); 185 }; 186 ThankYouScreen = function() { 187 var $screen, self; 188 self = this; 189 $screen = $screen; 190 $.extend(self, { 191 show: function() { 192 $("#un-thankyou").show(); 193 $("#un-feedback-close").click(function() { 194 usernoise.window.hide(); 195 return false; 196 }); 197 } 198 }); 199 }; 200 UsernoiseWindow = function(windowSelector) { 201 var $window, detectBrowser, self, showThankYouHandler; 202 detectBrowser = function() { 203 if (!$("#wrapper").hasClass("un")) { 204 return; 205 } 206 $("#wrapper").addClass("un"); 207 if (browser.msie7) { 208 $("#wrapper").addClass("un-ie7"); 209 } 210 if (browser.msie8) { 211 $("#wrapper").addClass("un-ie8"); 212 } 213 }; 214 showThankYouHandler = function(event, html) { 215 self.thankYouScreen = new ThankYouScreen($window.find(".thank-you-screen")); 216 self.thankYouScreen.show(html); 217 }; 218 self = this; 219 $window = $("#window"); 220 detectBrowser(); 221 $.extend(self, { 222 hide: function() { 223 window.parent.usernoiseButton.button.hideWindow(); 224 }, 225 adjustSize: function() { 226 $window.css({ 227 "margin-top": "-" + $window.height() / 2 + "px", 228 "margin-left": "-" + $window.width() / 2 + "px" 229 }); 230 } 231 }); 232 self.adjustSize(); 233 }; 234 browser = {}; 235 if (navigator && navigator.appVersion) { 236 browser.msie6 = navigator.appVersion.indexOf("MSIE 6.0") !== -1; 237 browser.msie7 = navigator.appVersion.indexOf("MSIE 7.0") !== -1; 238 browser.msie8 = navigator.appVersion.indexOf("MSIE 8.0") !== -1; 239 } 240 if (browser.msie6 || browser.msie7) { 241 return; 242 } 243 usernoise.UsernoiseButton = UsernoiseButton; 244 usernoise.FeedbackForm = FeedbackForm; 245 usernoise.Errors = Errors; 246 usernoise.ThankYouScreen = ThankYouScreen; 247 $.fn.unAutoPlaceholder = function() { 248 $(this).each(function() { 249 $(this).attr("data-default", $(this).val()); 250 $(this).focus(function() { 251 if ($(this).val() === $(this).attr("data-default")) { 252 $(this).val(""); 253 $(this).addClass("text-normal"); 254 $(this).removeClass("text-empty"); 255 } 256 }); 257 $(this).blur(function() { 258 if ($(this).val() === "") { 259 $(this).val($(this).attr("data-default")); 260 $(this).removeClass("text-normal"); 261 $(this).addClass("text-empty"); 262 } 263 }); 264 }); 265 }; 266 $.fn.unSerializeObject = function() { 267 var a, o; 268 o = {}; 269 a = this.serializeArray(); 270 $.each(a, function() { 271 if (o[this.name]) { 272 if (!o[this.name].push) { 273 o[this.name] = [o[this.name]]; 274 } 275 o[this.name].push(this.value || ""); 276 } else { 277 o[this.name] = this.value || ""; 278 } 279 }); 280 return o; 281 }; 282 usernoise.helpers = { 283 parseJSON: function(json) { 284 if ($.parseJSON) { 285 return $.parseJSON(json); 286 } else { 287 return eval_("(" + json + ")"); 288 } 289 } 290 }; 291 usernoise.Window = UsernoiseWindow; 292 }); 293 294}).call(this); 295 296/*
297//@ sourceMappingURL=usernoise.map 298*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.