| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 <meta name="title" content="Adblock Browser Beta Launch" /> | |
| 2 <meta property="og:title" content="Adblock Browser Beta Launch" /> | |
| 3 <meta name="description" content="Want Adblock Browser for your smartphone or ta blet? Join the Adblock Browser for Android Beta Google+ community." /> | |
| 4 <meta property="og:description" content="Want Adblock Browser for your smartphon e or tablet? Join the Adblock Browser for Android Beta Google+ community." /> | |
| 5 | |
| 6 <style type="text/css"> | 1 <style type="text/css"> |
| 7 #content * | 2 #content * |
| 8 { | 3 { |
| 9 box-sizing: content-box; | 4 box-sizing: content-box; |
| 10 } | 5 } |
| 11 | 6 |
| 12 #content h1 | 7 #content h1 |
| 13 { | 8 { |
| 14 margin-bottom: 28px; | 9 margin-bottom: 28px; |
| 15 } | 10 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 if ("addEventListener" in obj) | 129 if ("addEventListener" in obj) |
| 135 { | 130 { |
| 136 obj.addEventListener(type, function(ev) | 131 obj.addEventListener(type, function(ev) |
| 137 { | 132 { |
| 138 if (listener(ev) === false) | 133 if (listener(ev) === false) |
| 139 ev.preventDefault(); | 134 ev.preventDefault(); |
| 140 }, useCapture); | 135 }, useCapture); |
| 141 } | 136 } |
| 142 else | 137 else |
| 143 { | 138 { |
| 139 // IE 8 | |
| 144 if (type == "DOMContentLoaded") | 140 if (type == "DOMContentLoaded") |
| 145 type = "readystatechange"; | 141 type = "readystatechange"; |
| 146 | 142 |
| 147 type = "on" + type; | 143 type = "on" + type; |
| 148 // IE 8 | |
| 149 if ("attachEvent" in obj) | 144 if ("attachEvent" in obj) |
| 150 { | 145 { |
| 151 obj.attachEvent(type, function() | 146 obj.attachEvent(type, function() |
| 152 { | 147 { |
| 153 if (document.readyState == "complete" && listener(event) === false) | 148 if (document.readyState == "complete" && listener(event) === false) |
| 154 event.returnValue = false; | 149 event.returnValue = false; |
| 155 }); | 150 }); |
| 156 } | 151 } |
| 157 else | 152 else |
| 158 { | 153 { |
| 159 obj[type] = listener; | 154 obj[type] = listener; |
| 160 } | 155 } |
| 161 } | 156 } |
| 162 } | 157 } |
| 163 | 158 |
| 164 function addPlaceholder(textbox) | 159 function addPlaceholder(textbox) |
| 165 { | 160 { |
| 166 textbox.setAttribute("class", "placeholder"); | 161 textbox.setAttribute("class", "placeholder"); |
| 167 textbox.value = getPlaceholderText(); | 162 textbox.value = getPlaceholderText(); |
| 168 } | 163 } |
| 169 | 164 |
| 170 function getPlaceholderText() | 165 function getPlaceholderText() |
| 171 { | 166 { |
| 172 return document.getElementById("subscribe-textbox").placeholder; | 167 return document.getElementById("subscribe-textbox").getAttribute("placeholder" ); |
|
Sebastian Noack
2015/04/24 15:46:10
This won't work on browsers that don't support pla
saroyanm
2015/04/24 15:54:05
Actually I've tested it with IE8 and it works grea
| |
| 173 } | 168 } |
| 174 | 169 |
| 175 function contentLoad() | 170 function contentLoad() |
| 176 { | 171 { |
| 177 var emailTextbox = document.getElementById("subscribe-textbox"); | 172 var emailTextbox = document.getElementById("subscribe-textbox"); |
| 178 | 173 |
| 179 // textbox placeholder implementation for browsers | 174 // IE9 + Safari iOS |
| 180 // that don't support placeholder attribute | |
|
Sebastian Noack
2015/04/24 15:46:10
Nit: You might want to name Safari iOS and IE9 her
saroyanm
2015/04/24 15:54:05
Done.
| |
| 181 if (!("placeholder" in document.createElement("input")) | 175 if (!("placeholder" in document.createElement("input")) |
| 182 && !emailTextbox.value) | 176 && !emailTextbox.value) |
| 183 { | 177 { |
| 184 addPlaceholder(emailTextbox); | 178 addPlaceholder(emailTextbox); |
| 185 addListener(emailTextbox, "focus", function() | 179 addListener(emailTextbox, "focus", function() |
| 186 { | 180 { |
| 187 if (emailTextbox.value == getPlaceholderText()) | 181 if (emailTextbox.value == getPlaceholderText()) |
| 188 { | 182 { |
| 189 emailTextbox.value = ""; | 183 emailTextbox.value = ""; |
| 190 emailTextbox.setAttribute("class", ""); | 184 emailTextbox.setAttribute("class", ""); |
| 191 } | 185 } |
| 192 }, false); | 186 }, false); |
| 193 | 187 |
| 194 addListener(emailTextbox, "blur", function() | 188 addListener(emailTextbox, "blur", function() |
| 195 { | 189 { |
| 196 if (!emailTextbox.value) | 190 if (!emailTextbox.value) |
| 197 addPlaceholder(emailTextbox); | 191 addPlaceholder(emailTextbox); |
| 198 }, false); | 192 }, false); |
| 199 } | 193 } |
| 200 | 194 |
| 201 addListener(document.getElementById("subscribe-form"), "submit", function() | 195 addListener(document.getElementById("subscribe-form"), "submit", function() |
| 202 { | 196 { |
| 203 var formElement = document.getElementById("subscribe-form"); | 197 var formElement = document.getElementById("subscribe-form"); |
| 204 if (!window.XMLHttpRequest) | 198 if (!window.XMLHttpRequest) |
| 205 { | 199 { |
| 206 formElement.submit(); | 200 formElement.submit(); |
| 207 return false; | 201 return false; |
| 208 } | 202 } |
| 209 | 203 |
| 204 var pathArray = window.location.pathname.split("/"); | |
| 210 var params = emailTextbox.name + "=" + encodeURIComponent(emailTextbox.value ); | 205 var params = emailTextbox.name + "=" + encodeURIComponent(emailTextbox.value ); |
| 206 params += "&lang=" + pathArray[1]; | |
| 211 var request = new XMLHttpRequest(); | 207 var request = new XMLHttpRequest(); |
| 212 request.open("POST", formElement.action, true); | 208 request.open("POST", formElement.action, true); |
| 213 request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded" ); | 209 request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded" ); |
| 214 addListener(request, "readystatechange", function() | 210 addListener(request, "readystatechange", function() |
| 215 { | 211 { |
| 216 if (request.readyState == 4) | 212 if (request.readyState == 4) |
| 217 { | 213 { |
| 218 if (request.status >= 200 && request.status < 300) | 214 if (request.status >= 200 && request.status < 300) |
| 219 { | 215 { |
| 220 formElement.setAttribute("class", "success"); | 216 formElement.setAttribute("class", "success"); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 235 } | 231 } |
| 236 } | 232 } |
| 237 }, false); | 233 }, false); |
| 238 request.send(params); | 234 request.send(params); |
| 239 return false; | 235 return false; |
| 240 }, false); | 236 }, false); |
| 241 } | 237 } |
| 242 addListener(document, "DOMContentLoaded", contentLoad, false); | 238 addListener(document, "DOMContentLoaded", contentLoad, false); |
| 243 //]]> | 239 //]]> |
| 244 </script> | 240 </script> |
| LEFT | RIGHT |