Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
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"> | |
7 #content * | |
8 { | |
9 box-sizing: content-box; | |
10 } | |
11 | |
12 #content h1 | |
13 { | |
14 margin-bottom: 28px; | |
15 } | |
16 | |
17 ol | |
18 { | |
19 font-size: 16px; | |
20 padding-left: 60px; | |
21 } | |
22 | |
23 ol li | |
24 { | |
25 margin-bottom: 14px; | |
26 } | |
27 | |
28 #content h3.subscribe-header | |
29 { | |
30 font-size: 18px; | |
31 margin-bottom: 14px; | |
32 } | |
33 | |
34 .subscribe-description | |
35 { | |
36 margin: 14px 0px 20px 0px; | |
37 } | |
38 | |
39 .button-community-wrapper | |
40 { | |
41 display: inline-block; | |
42 text-align: center; | |
43 border: solid 1px #4CAE4C; | |
44 border-radius: 3px; | |
45 background-color: #5CB85C; | |
46 margin: 10px 0px 30px 0px; | |
47 } | |
48 | |
49 .button-community-wrapper a | |
50 { | |
51 display: block; | |
52 padding: 25px 20px; | |
53 color: #FFFFFF; | |
54 font-weight: bold; | |
55 font-size: 14px; | |
56 text-decoration: none; | |
57 } | |
58 | |
59 #subscribe-textbox | |
60 { | |
61 border: solid 1px #B5B4B0; | |
62 margin-right: 20px; | |
63 padding-left: 10px; | |
64 padding-right: 10px; | |
65 font-size: 16px; | |
66 width: 276px; | |
67 line-height: 44px; | |
68 height: 44px; | |
69 } | |
70 | |
71 #subscribe-textbox.placeholder | |
72 { | |
73 color: #B5B4B0; | |
74 } | |
75 | |
76 #subscribe-button | |
77 { | |
78 border: solid 1px #357EBD; | |
79 border-radius: 3px; | |
80 background-color: #428BCA; | |
81 color: #FFFFFF; | |
82 font-size: 14px; | |
83 font-weight: bold; | |
84 min-width: 146px; | |
85 height: 44px; | |
86 } | |
87 | |
88 #subscribe-button span | |
89 { | |
90 padding-left: 30px; | |
91 padding-right: 30px; | |
92 } | |
93 | |
94 .disclaimer | |
95 { | |
96 display: none; | |
97 font-size: 14px; | |
98 color: #D00; | |
99 border: 1px solid #D00; | |
100 border-radius: 5px; | |
101 padding: 5px; | |
102 margin-top: 30px; | |
103 } | |
104 | |
105 html[lang="fr"] .disclaimer.lang-fr | |
106 { | |
107 display: block; | |
108 } | |
109 | |
110 #subscribe-form .empty-label, #subscribe-form .sucess-label, | |
111 #response-error, #subscribe-form .invalid-label, #email-placeholder, | |
112 #subscribe-form.success input, #subscribe-form.success button | |
113 { | |
114 display: none; | |
115 } | |
116 | |
117 #subscribe-form .empty-label, | |
118 #subscribe-form .invalid-label | |
119 { | |
120 margin-top: 30px; | |
121 } | |
122 | |
123 #subscribe-form.success .sucess-label, | |
124 #subscribe-form.empty .empty-label, | |
125 #subscribe-form.invalid .invalid-label, | |
126 #subscribe-form.error #response-error | |
127 { | |
128 display: block; | |
129 } | |
130 </style> | |
131 | |
132 <script type="text/javascript"> | |
133 //<![CDATA[ | |
134 function addListener(obj, type, listener, useCapture) | |
135 { | |
136 if ("addEventListener" in obj) | |
137 { | |
138 obj.addEventListener(type, function(ev) | |
139 { | |
140 if (listener(ev) === false) | |
141 ev.preventDefault(); | |
142 }, useCapture); | |
143 } | |
144 else | |
145 { | |
146 if (type == "DOMContentLoaded") | |
147 type = "readystatechange"; | |
148 | |
149 type = "on" + type; | |
150 if ("attachEvent" in obj) | |
Sebastian Noack
2015/04/24 10:22:58
Nit: Please add comment: // IE8
saroyanm
2015/04/24 14:56:31
Done.
| |
151 { | |
152 obj.attachEvent(type, function() | |
153 { | |
154 if (document.readyState == "complete" && listener(event) === false) | |
155 event.returnValue = false; | |
156 }); | |
157 } | |
158 else | |
159 { | |
160 obj[type] = listener; | |
161 } | |
162 } | |
163 } | |
164 | |
165 function addPlaceholder(textbox) | |
166 { | |
167 textbox.setAttribute("class", "placeholder"); | |
168 textbox.value = getPlaceholderText(); | |
169 } | |
170 | |
171 function getPlaceholderText() | |
172 { | |
173 var textProperty = "innerText" in document.body ? "innerText" : "textContent"; | |
174 return document.getElementById("email-placeholder")[textProperty]; | |
Sebastian Noack
2015/04/24 10:22:58
Why don't you get the text from the placeholder at
saroyanm
2015/04/24 14:56:31
Done.
| |
175 } | |
176 | |
177 function contentLoad() | |
178 { | |
179 var emailTextbox = document.getElementById("subscribe-textbox"); | |
180 | |
181 // textbox placeholder implementation for browsers | |
182 // that don't support placeholder attribute | |
183 if (!("placeholder" in document.createElement("input")) | |
184 && !emailTextbox.value) | |
185 { | |
186 addPlaceholder(emailTextbox); | |
187 addListener(emailTextbox, "focus", function() | |
188 { | |
189 if (emailTextbox.value == getPlaceholderText()) | |
190 { | |
191 emailTextbox.value = ""; | |
192 emailTextbox.setAttribute("class", ""); | |
193 } | |
194 }, false); | |
195 | |
196 addListener(emailTextbox, "blur", function() | |
197 { | |
198 if (!emailTextbox.value) | |
199 addPlaceholder(emailTextbox); | |
200 }, false); | |
201 } | |
202 | |
203 addListener(document.getElementById("subscribe-form"), "submit", function() | |
204 { | |
205 var formElement = document.getElementById("subscribe-form"); | |
206 if (!emailTextbox.value || emailTextbox.value == getPlaceholderText()) | |
207 { | |
208 formElement.setAttribute("class", "empty"); | |
209 return false; | |
210 } | |
211 | |
212 if (!window.XMLHttpRequest) | |
213 { | |
214 formElement.submit(); | |
215 return false; | |
216 } | |
217 | |
218 var params = emailTextbox.name + "=" + encodeURIComponent(emailTextbox.value ); | |
219 var request = new XMLHttpRequest(); | |
220 request.open("POST", formElement.action, true); | |
221 request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded" ); | |
222 request.setRequestHeader("Content-length", params.length); | |
Sebastian Noack
2015/04/24 10:22:58
Nit: "Content-Length" please.
Also do we actually
saroyanm
2015/04/24 14:56:31
Done.
| |
223 addListener(request, "readystatechange", function() | |
224 { | |
225 if (request.readyState == 4) | |
226 { | |
227 if (request.status >= 200 && request.status < 300) | |
228 { | |
229 formElement.setAttribute("class", "success"); | |
230 } | |
231 else if (request.status == 400) | |
232 { | |
233 formElement.setAttribute("class", "invalid"); | |
234 } | |
235 else | |
236 { | |
237 var textProperty = "innerText" in document.body ? "innerText" : "textC ontent"; | |
Sebastian Noack
2015/04/24 10:22:58
I find it a little weird to check for existence of
saroyanm
2015/04/24 14:56:31
Done.
| |
238 document.getElementById("response-error")[textProperty] = request.stat usText; | |
239 formElement.setAttribute("class", "error"); | |
240 } | |
241 } | |
242 }, false); | |
243 request.send(params); | |
244 return false; | |
245 }, false); | |
246 } | |
247 addListener(document, "DOMContentLoaded", contentLoad, false); | |
248 //]]> | |
249 </script> | |
OLD | NEW |