| Left: | ||
| Right: |
| LEFT | RIGHT |
|---|---|
| 1 <link rel="canonical" href="https://adblockplus.org/"/> | |
|
Thomas Greiner
2015/04/21 13:31:45
This page is not a duplicate of "https://adblockpl
saroyanm
2015/04/22 15:27:08
Done.
| |
| 2 <meta name="title" content="Adblock Browser Beta Launch"> | |
| 3 <meta property="og:title" content="Adblock Browser Beta Launch"> | |
| 4 <meta name="description" content="Want Adblock Browser for your smartphone or ta blet? Join the Adblock Browser for Android Beta Google+ community."> | |
| 5 <meta property="og:description" content="Want Adblock Browser for your smartphon e or tablet? Join the Adblock Browser for Android Beta Google+ community."> | |
|
Thomas Greiner
2015/04/21 13:31:45
Anwiki requires that each tag is closed which also
saroyanm
2015/04/22 15:27:08
Done.
| |
| 6 | |
| 7 <style type="text/css"> | 1 <style type="text/css"> |
| 8 * | 2 #content * |
|
Thomas Greiner
2015/04/21 13:31:45
This style will also be applied to elements outsid
saroyanm
2015/04/22 15:27:08
Done.
| |
| 9 { | 3 { |
| 10 box-sizing: content-box; | 4 box-sizing: content-box; |
| 11 } | 5 } |
| 12 | 6 |
| 13 #content h1 | 7 #content h1 |
| 14 { | 8 { |
| 15 margin-bottom: 28px; | 9 margin-bottom: 28px; |
|
Thomas Greiner
2015/04/21 13:31:45
Why is this necessary? h1 tags already have margin
saroyanm
2015/04/22 15:27:08
It's not specified, but in the style-guide image i
Thomas Greiner
2015/04/23 10:47:11
In that case please make it at least a round numer
| |
| 16 } | 10 } |
| 17 | 11 |
| 18 ol | 12 ol |
| 19 { | 13 { |
| 20 font-size: 16px; | 14 font-size: 16px; |
| 21 padding-left: 60px; | 15 padding-left: 60px; |
| 22 } | 16 } |
| 23 | 17 |
| 24 ol li | 18 ol li |
| 25 { | 19 { |
| 26 margin-bottom: 14px; | 20 margin-bottom: 14px; |
| 27 } | 21 } |
| 28 | 22 |
| 29 #content h3.subscribe-header | 23 #content h3.subscribe-header |
| 30 { | 24 { |
| 31 font-size: 18px; | 25 font-size: 18px; |
| 32 margin-bottom: 14px; | 26 margin-bottom: 14px; |
| 33 } | 27 } |
| 34 | 28 |
| 35 .subscribe-description | 29 .subscribe-description |
| 36 { | 30 { |
| 37 margin: 14px 0px 20px 0px; | 31 margin: 14px 0px 20px 0px; |
| 38 } | 32 } |
| 39 | 33 |
| 40 a.button-community | 34 .button-community-wrapper |
| 41 { | 35 { |
| 42 display: block; | 36 display: inline-block; |
|
Thomas Greiner
2015/04/21 13:31:45
Note that making it a block element could lead to
saroyanm
2015/04/22 15:27:08
I see, hope current solution is better. Please not
Thomas Greiner
2015/04/23 10:47:11
Making the anchor tag into an inline-block and wra
| |
| 37 text-align: center; | |
| 43 border: solid 1px #4CAE4C; | 38 border: solid 1px #4CAE4C; |
| 44 border-radius: 3px; | 39 border-radius: 3px; |
| 45 background-color: #5CB85C; | 40 background-color: #5CB85C; |
| 41 margin: 10px 0px 30px 0px; | |
| 42 } | |
| 43 | |
| 44 .button-community-wrapper a | |
| 45 { | |
| 46 display: block; | |
| 47 padding: 25px 20px; | |
| 46 color: #FFFFFF; | 48 color: #FFFFFF; |
| 47 margin: 24px 0px 48px 0px; | |
| 48 text-align: center; | |
| 49 padding: 25px 0px; | |
| 50 width: 298px; | |
|
Thomas Greiner
2015/04/21 13:31:45
Please replace the static width with a padding to
saroyanm
2015/04/22 15:27:08
Good point.
| |
| 51 font-weight: bold; | 49 font-weight: bold; |
| 52 font-size: 14px; | 50 font-size: 14px; |
| 53 text-decoration: none; | 51 text-decoration: none; |
| 54 } | 52 } |
| 55 | 53 |
| 56 #subscribe-textbox | 54 #subscribe-textbox |
| 57 { | 55 { |
| 58 border: solid 1px #B5B4B0; | 56 border: solid 1px #B5B4B0; |
| 59 margin-right: 18px; | 57 margin-right: 20px; |
|
Thomas Greiner
2015/04/21 13:31:45
The exact pixel value is not specified in the desi
saroyanm
2015/04/22 15:27:08
Done.
| |
| 60 padding-left: 10px; | 58 padding-left: 10px; |
|
Thomas Greiner
2015/04/21 13:31:45
What about `padding-right` for symmetry?
saroyanm
2015/04/22 15:27:08
Done.
| |
| 59 padding-right: 10px; | |
| 61 font-size: 16px; | 60 font-size: 16px; |
| 62 width: 276px; | 61 width: 276px; |
| 63 height: 44px; | 62 line-height: 44px; |
|
Thomas Greiner
2015/04/21 13:31:45
Using `line-height` is preferable in this case to
saroyanm
2015/04/22 15:27:08
Done.
| |
| 63 height: 44px; /* IE 8 */ | |
| 64 } | 64 } |
| 65 | 65 |
| 66 #subscribe-textbox.placeholder | 66 #subscribe-textbox.placeholder |
| 67 { | 67 { |
| 68 color: #B5B4B0; | 68 color: #B5B4B0; |
| 69 } | 69 } |
| 70 | 70 |
| 71 #subscribe-button | 71 #subscribe-button |
| 72 { | 72 { |
| 73 border: solid 1px #357EBD; | 73 border: solid 1px #357EBD; |
| 74 border-radius: 3px; | 74 border-radius: 3px; |
| 75 background-color: #428BCA; | 75 background-color: #428BCA; |
| 76 color: #FFFFFF; | 76 color: #FFFFFF; |
| 77 font-size: 14px; | 77 font-size: 14px; |
| 78 font-weight: bold; | 78 font-weight: bold; |
| 79 width: 146px; | 79 min-width: 146px; |
|
Thomas Greiner
2015/04/21 13:31:45
Again, using padding-left/right would ensure that
saroyanm
2015/04/22 15:27:08
Done.
| |
| 80 height: 44px; | 80 height: 44px; |
| 81 } | |
| 82 | |
| 83 #subscribe-button span | |
| 84 { | |
| 85 padding-left: 30px; | |
| 86 padding-right: 30px; | |
| 81 } | 87 } |
| 82 | 88 |
| 83 .disclaimer | 89 .disclaimer |
| 84 { | 90 { |
| 85 display: none; | 91 display: none; |
| 86 font-size: 14px; | 92 font-size: 14px; |
| 87 color: #000; | |
| 88 text-align: left; | |
|
Thomas Greiner
2015/04/21 13:31:45
I assume this is a copy&paste leftover, right?
saroyanm
2015/04/22 15:27:08
Done.
| |
| 89 color: #D00; | 93 color: #D00; |
| 90 border: 1px solid #D00; | 94 border: 1px solid #D00; |
| 91 border-radius: 5px; | 95 border-radius: 5px; |
| 92 padding: 5px; | 96 padding: 5px; |
| 93 margin-top: 30px; | 97 margin-top: 30px; |
| 94 } | 98 } |
| 95 | 99 |
| 96 html[lang="fr"] .disclaimer.lang-fr | 100 html[lang="fr"] .disclaimer.lang-fr |
| 97 { | 101 { |
| 98 display: block; | 102 display: block; |
| 99 } | 103 } |
| 100 | 104 |
| 101 #subscribe-form .empty-label, #subscribe-form .sucess-label, | 105 #subscribe-form .sucess-label, #response-error, |
| 102 #response-error, #subscribe-form .invalid-label | 106 #subscribe-form .invalid-label, #subscribe-form.success input, |
|
Thomas Greiner
2015/04/21 13:31:45
Note that translators won't be able to translate t
saroyanm
2015/04/22 15:27:08
As discussed, even the hidden texts are being show
Thomas Greiner
2015/04/23 10:47:11
As long as it's tested and it works, that's fine w
| |
| 107 #subscribe-form.success button | |
| 103 { | 108 { |
| 104 display: none; | 109 display: none; |
| 105 } | 110 } |
| 106 | 111 |
| 107 #subscribe-form .empty-label, | |
| 108 #subscribe-form .invalid-label | 112 #subscribe-form .invalid-label |
| 109 { | 113 { |
| 110 margin-top: 30px; | 114 margin-top: 30px; |
| 111 } | 115 } |
| 112 | 116 |
| 113 #subscribe-form.success input | 117 #subscribe-form.success .sucess-label, |
| 114 { | 118 #subscribe-form.invalid .invalid-label, |
| 115 display: none; | 119 #subscribe-form.error #response-error |
| 116 } | |
| 117 | |
| 118 #subscribe-form.success .sucess-label | |
|
Thomas Greiner
2015/04/21 13:31:45
You combined similar styles above in line 101 so I
saroyanm
2015/04/22 15:27:08
Done.
| |
| 119 { | 120 { |
| 120 display: block; | 121 display: block; |
| 121 } | 122 } |
| 122 | |
| 123 #subscribe-form.empty .empty-label | |
| 124 { | |
| 125 display: block; | |
| 126 } | |
| 127 | |
| 128 #subscribe-form.invalid .invalid-label | |
| 129 { | |
| 130 display: block; | |
| 131 } | |
| 132 | |
| 133 #subscribe-form.error #response-error | |
| 134 { | |
| 135 display: block; | |
| 136 } | |
| 137 </style> | 123 </style> |
| 138 | 124 |
| 139 <script type="text/javascript"> | 125 <script type="text/javascript"> |
| 126 //<![CDATA[ | |
| 127 function addListener(obj, type, listener, useCapture) | |
| 128 { | |
| 129 if ("addEventListener" in obj) | |
| 130 { | |
| 131 obj.addEventListener(type, function(ev) | |
| 132 { | |
| 133 if (listener(ev) === false) | |
| 134 ev.preventDefault(); | |
| 135 }, useCapture); | |
| 136 } | |
| 137 else | |
| 138 { | |
| 139 // IE 8 | |
| 140 if (type == "DOMContentLoaded") | |
| 141 type = "readystatechange"; | |
| 142 | |
| 143 type = "on" + type; | |
| 144 if ("attachEvent" in obj) | |
| 145 { | |
| 146 obj.attachEvent(type, function() | |
| 147 { | |
| 148 if (document.readyState == "complete" && listener(event) === false) | |
| 149 event.returnValue = false; | |
| 150 }); | |
| 151 } | |
| 152 else | |
| 153 { | |
| 154 obj[type] = listener; | |
| 155 } | |
| 156 } | |
| 157 } | |
| 158 | |
| 140 function addPlaceholder(textbox) | 159 function addPlaceholder(textbox) |
| 141 { | 160 { |
| 142 textbox.setAttribute("class", "placeholder"); | 161 textbox.setAttribute("class", "placeholder"); |
| 143 textbox.value = "Your email address"; | 162 textbox.value = getPlaceholderText(); |
|
Thomas Greiner
2015/04/21 13:31:45
This text is not translatable.
saroyanm
2015/04/22 15:27:08
Done.
| |
| 163 } | |
| 164 | |
| 165 function getPlaceholderText() | |
| 166 { | |
| 167 return document.getElementById("subscribe-textbox").getAttribute("placeholder" ); | |
| 144 } | 168 } |
| 145 | 169 |
| 146 function contentLoad() | 170 function contentLoad() |
| 147 { | 171 { |
| 148 if (document.readyState != "interactive") | |
| 149 return; | |
| 150 | |
| 151 var emailTextbox = document.getElementById("subscribe-textbox"); | 172 var emailTextbox = document.getElementById("subscribe-textbox"); |
| 152 | 173 |
| 153 // textbox placeholder implementation for browsers | 174 // IE9 + Safari iOS |
| 154 // that don't support placeholder attribute | 175 if (!("placeholder" in document.createElement("input")) |
| 155 if (document.createElement("input").placeholder == undefined | |
|
Thomas Greiner
2015/04/21 13:31:45
A less error-prone way would be `!("placeholder" i
saroyanm
2015/04/22 15:27:08
Done.
| |
| 156 && !emailTextbox.value) | 176 && !emailTextbox.value) |
| 157 { | 177 { |
| 158 addPlaceholder(emailTextbox); | 178 addPlaceholder(emailTextbox); |
| 159 emailTextbox.addEventListener("focus", function() | 179 addListener(emailTextbox, "focus", function() |
|
Thomas Greiner
2015/04/21 13:31:45
IE8 doesn't support `addEventListener` yet. Theref
saroyanm
2015/04/22 15:27:08
Done.
| |
| 160 { | 180 { |
| 161 if (emailTextbox.value == "Your email address") | 181 if (emailTextbox.value == getPlaceholderText()) |
| 162 { | 182 { |
| 163 emailTextbox.value = ""; | 183 emailTextbox.value = ""; |
| 164 emailTextbox.setAttribute("class", ""); | 184 emailTextbox.setAttribute("class", ""); |
| 165 } | 185 } |
| 166 }, false); | 186 }, false); |
| 167 | 187 |
| 168 emailTextbox.addEventListener("blur", function() | 188 addListener(emailTextbox, "blur", function() |
| 169 { | 189 { |
| 170 if (!emailTextbox.value) | 190 if (!emailTextbox.value) |
| 171 addPlaceholder(emailTextbox); | 191 addPlaceholder(emailTextbox); |
| 172 }, false); | 192 }, false); |
| 173 } | 193 } |
| 174 | 194 |
| 175 document.getElementById("subscribe-form").addEventListener("submit", function( e) | 195 addListener(document.getElementById("subscribe-form"), "submit", function() |
| 176 { | 196 { |
| 177 e.preventDefault(); | |
| 178 var formElement = document.getElementById("subscribe-form"); | 197 var formElement = document.getElementById("subscribe-form"); |
| 179 if (!emailTextbox.value) | 198 if (!window.XMLHttpRequest) |
| 180 { | 199 { |
| 181 formElement.setAttribute("class", "empty"); | 200 formElement.submit(); |
| 182 return; | 201 return false; |
| 183 } | 202 } |
| 184 | 203 |
| 185 // Simple email validation for browsers | 204 var pathArray = window.location.pathname.split("/"); |
| 186 // that don't support input of type email | 205 var params = emailTextbox.name + "=" + encodeURIComponent(emailTextbox.value ); |
| 187 var input = document.createElement("input"); | 206 params += "&lang=" + pathArray[1]; |
| 188 input.setAttribute("type", "email"); | |
| 189 if (input.type !== "email" | |
| 190 && !(/(.+)@(.+){2,}\.(.+){2,}/.test(emailTextbox.value))) | |
|
Sebastian Noack
2015/04/22 07:52:45
Didn't we agree to leave email validation up to th
saroyanm
2015/04/22 15:27:08
Yes we did, actually I was thinking while we are s
Sebastian Noack
2015/04/23 11:57:58
Yes, we still support IE8. But IMO that doesn't me
saroyanm
2015/04/23 13:29:04
I know it would be much more easy not to support t
Sebastian Noack
2015/04/23 13:32:49
I see. Given the design, I agree that the placehol
saroyanm
2015/04/23 13:55:11
Please note that form validation is not supported
Sebastian Noack
2015/04/23 14:05:29
Oh, didn't realize.
saroyanm
2015/04/23 14:26:26
Translated error message will be nice to have feat
Sebastian Noack
2015/04/23 14:41:19
Exactly, it would be a nice to have feature, and t
saroyanm
2015/04/23 15:02:05
If I can consider only IE 8 and IE9 implementation
Sebastian Noack
2015/04/23 15:31:56
It's probably not worth further arguing whether we
saroyanm
2015/04/23 15:45:52
Sure I can response to any status code, that would
Sebastian Noack
2015/04/23 16:00:12
Server-side email validation has already been impl
saroyanm
2015/04/23 17:13:43
Done.
| |
| 191 { | |
| 192 formElement.setAttribute("class", "invalid"); | |
| 193 return; | |
| 194 } | |
| 195 | |
| 196 if (!window.XMLHttpRequest) | |
|
Thomas Greiner
2015/04/21 13:31:45
According to https://developer.mozilla.org/en-US/d
saroyanm
2015/04/22 15:27:08
I'm preventing default on line: 177, so I assume i
Thomas Greiner
2015/04/23 10:47:11
1) We don't support IE7 anymore.
2) Did you find a
| |
| 197 { | |
| 198 formElement.submit(); | |
| 199 return; | |
| 200 } | |
| 201 | |
| 202 var params = emailTextbox.name + "=" + emailTextbox.value; | |
|
Thomas Greiner
2015/04/21 13:31:45
I'd suggest encoding the value using `encodeURICom
saroyanm
2015/04/22 15:27:08
Done.
| |
| 203 var request = new XMLHttpRequest(); | 207 var request = new XMLHttpRequest(); |
| 204 request.open("POST", formElement.action); | 208 request.open("POST", formElement.action, true); |
|
Thomas Greiner
2015/04/21 13:31:45
Please add the third parameter here to explicitly
saroyanm
2015/04/22 15:27:08
Done.
| |
| 205 request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded" ); | 209 request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded" ); |
| 206 request.setRequestHeader("Content-length", params.length); | 210 addListener(request, "readystatechange", function() |
| 207 request.addEventListener("load", function() | 211 { |
| 208 { | 212 if (request.readyState == 4) |
| 209 if (request.status == 200) | |
|
Sebastian Noack
2015/04/22 07:52:45
Since you only need to check whether the request w
saroyanm
2015/04/22 15:27:08
Done.
| |
| 210 { | 213 { |
| 211 document.getElementById("subscribe-form").setAttribute("class", "success "); | 214 if (request.status >= 200 && request.status < 300) |
|
Thomas Greiner
2015/04/21 13:31:45
You can just access `formElement` here.
saroyanm
2015/04/22 15:27:08
Done.
| |
| 212 } | 215 { |
| 213 else | 216 formElement.setAttribute("class", "success"); |
| 214 { | 217 } |
| 215 document.getElementById("response-error").innerHTML = request.statusText ; | 218 else if (request.status == 400) |
|
Thomas Greiner
2015/04/21 13:31:45
No need to use `innerHTML` here so I'd suggest usi
saroyanm
2015/04/22 15:27:08
Done.
| |
| 216 document.getElementById("subscribe-form").setAttribute("class", "error") ; | 219 { |
|
Thomas Greiner
2015/04/21 13:31:45
You can just access `formElement` here.
saroyanm
2015/04/22 15:27:08
Done.
| |
| 220 formElement.setAttribute("class", "invalid"); | |
| 221 } | |
| 222 else | |
| 223 { | |
| 224 var errorWrapper = document.getElementById("response-error"); | |
| 225 if ("textContent" in errorWrapper) | |
| 226 errorWrapper.textContent = request.statusText; | |
| 227 else // IE8 | |
| 228 errorWrapper.innerText = request.statusText; | |
| 229 | |
| 230 formElement.setAttribute("class", "error"); | |
| 231 } | |
| 217 } | 232 } |
| 218 }, false); | 233 }, false); |
| 219 request.send(params); | 234 request.send(params); |
| 235 return false; | |
| 220 }, false); | 236 }, false); |
| 221 } | 237 } |
| 222 document.addEventListener("readystatechange", contentLoad, false); | 238 addListener(document, "DOMContentLoaded", contentLoad, false); |
|
Thomas Greiner
2015/04/21 13:31:45
I understand that this is necessary for compatibil
Thomas Greiner
2015/04/21 13:31:45
I'd prefer to have this as a fallback instead. jQu
saroyanm
2015/04/22 15:27:08
I guess this should be covered in addListener meth
Thomas Greiner
2015/04/23 10:47:11
Yep, that's right.
| |
| 223 </script> | 239 //]]> |
| 240 </script> | |
| LEFT | RIGHT |