Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 27 matching lines...) Expand all Loading... | |
38 textbox.value = getPlaceholderText(textbox); | 38 textbox.value = getPlaceholderText(textbox); |
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.getElementsByClassName("subscribe-tex tbox")[0]; | 48 var emailTextbox = subscriptionElement.querySelectorAll(".subscribe-textbox" )[0]; |
saroyanm
2015/09/30 15:38:38
"getElementsByClassName" is not supported in IE8:
| |
49 | 49 |
50 // IE9 + Safari iOS | 50 // IE9 + Safari iOS |
51 if (!("placeholder" in document.createElement("input")) | 51 if (!("placeholder" in document.createElement("input")) |
52 && !emailTextbox.value) | 52 && !emailTextbox.value) |
53 { | 53 { |
54 addPlaceholder(emailTextbox); | 54 addPlaceholder(emailTextbox); |
55 addListener(emailTextbox, "focus", function() | 55 addListener(emailTextbox, "focus", function() |
56 { | 56 { |
57 if (emailTextbox.value == getPlaceholderText(textbox)) | 57 if (emailTextbox.value == getPlaceholderText(emailTextbox)) |
saroyanm
2015/09/30 15:38:39
textbox here is undefined, probably we need to cha
| |
58 { | 58 { |
59 emailTextbox.value = ""; | 59 emailTextbox.value = ""; |
60 emailTextbox.setAttribute("class", ""); | 60 emailTextbox.setAttribute("class", ""); |
61 } | 61 } |
62 }, false); | 62 }, false); |
63 | 63 |
64 addListener(emailTextbox, "blur", function() | 64 addListener(emailTextbox, "blur", function() |
65 { | 65 { |
66 if (!emailTextbox.value) | 66 if (!emailTextbox.value) |
67 addPlaceholder(emailTextbox); | 67 addPlaceholder(emailTextbox); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 } | 144 } |
145 | 145 |
146 function init() | 146 function init() |
147 { | 147 { |
148 container = document.getElementById("more-container"); | 148 container = document.getElementById("more-container"); |
149 initSubscriptionForm(document.getElementById("edge-subscription")); | 149 initSubscriptionForm(document.getElementById("edge-subscription")); |
150 } | 150 } |
151 | 151 |
152 init(); | 152 init(); |
153 })(); | 153 })(); |
LEFT | RIGHT |