| OLD | NEW |
| 1 (function() | 1 (function() |
| 2 { | 2 { |
| 3 function addListener(obj, type, listener, useCapture) | 3 function addListener(obj, type, listener, useCapture) |
| 4 { | 4 { |
| 5 if ("addEventListener" in obj) | 5 if ("addEventListener" in obj) |
| 6 { | 6 { |
| 7 obj.addEventListener(type, function(ev) | 7 obj.addEventListener(type, function(ev) |
| 8 { | 8 { |
| 9 if (listener(ev) === false) | 9 if (listener(ev) === false) |
| 10 ev.preventDefault(); | 10 ev.preventDefault(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 function getPlaceholderText(textbox) | 41 function getPlaceholderText(textbox) |
| 42 { | 42 { |
| 43 return textbox.getAttribute("placeholder"); | 43 return textbox.getAttribute("placeholder"); |
| 44 } | 44 } |
| 45 | 45 |
| 46 function initSubscriptionForm(subscriptionElement) | 46 function initSubscriptionForm(subscriptionElement) |
| 47 { | 47 { |
| 48 var emailTextbox = subscriptionElement.querySelectorAll(".subscribe-textbox"
)[0]; | 48 var emailTextbox = subscriptionElement.querySelectorAll(".subscribe-textbox"
)[0]; |
| 49 var reset = subscriptionElement.querySelectorAll(".reset-form")[0]; |
| 49 | 50 |
| 50 // IE9 + Safari iOS | 51 // IE9 + Safari iOS |
| 51 if (!("placeholder" in document.createElement("input")) | 52 if (!("placeholder" in document.createElement("input")) |
| 52 && !emailTextbox.value) | 53 && !emailTextbox.value) |
| 53 { | 54 { |
| 54 addPlaceholder(emailTextbox); | 55 addPlaceholder(emailTextbox); |
| 55 addListener(emailTextbox, "focus", function() | 56 addListener(emailTextbox, "focus", function() |
| 56 { | 57 { |
| 57 if (emailTextbox.value == getPlaceholderText(emailTextbox)) | 58 if (emailTextbox.value == getPlaceholderText(emailTextbox)) |
| 58 { | 59 { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 else // IE8 | 109 else // IE8 |
| 109 errorWrapper.innerText = request.statusText; | 110 errorWrapper.innerText = request.statusText; |
| 110 | 111 |
| 111 formElement.setAttribute("class", "error"); | 112 formElement.setAttribute("class", "error"); |
| 112 } | 113 } |
| 113 } | 114 } |
| 114 }, false); | 115 }, false); |
| 115 request.send(params); | 116 request.send(params); |
| 116 return false; | 117 return false; |
| 117 }, false); | 118 }, false); |
| 119 |
| 120 addListener(reset, "click", function() |
| 121 { |
| 122 formElement.removeAttribute("class"); |
| 123 return false; |
| 124 }, false); |
| 118 } | 125 } |
| 119 | 126 |
| 120 var visibleTab; | 127 var visibleTab; |
| 121 var container; | 128 var container; |
| 122 | 129 |
| 123 window.toggleMore = function() | 130 window.toggleMore = function() |
| 124 { | 131 { |
| 125 if (container.className == "hidden") | 132 if (container.className == "hidden") |
| 126 container.className = visibleTab || getDefaultTab(); | 133 container.className = visibleTab || getDefaultTab(); |
| 127 else | 134 else |
| (...skipping 16 matching lines...) Expand all Loading... |
| 144 } | 151 } |
| 145 | 152 |
| 146 function init() | 153 function init() |
| 147 { | 154 { |
| 148 container = document.getElementById("more-container"); | 155 container = document.getElementById("more-container"); |
| 149 initSubscriptionForm(document.getElementById("edge-subscription")); | 156 initSubscriptionForm(document.getElementById("edge-subscription")); |
| 150 } | 157 } |
| 151 | 158 |
| 152 init(); | 159 init(); |
| 153 })(); | 160 })(); |
| OLD | NEW |