Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: static/js/index.js

Issue 29322769: Issue 2844 - Create Microsoft Edge coming soon landing page (Closed)
Left Patch Set: Reorganize some CSS rules. Created Sept. 30, 2015, 2:29 p.m.
Right Patch Set: Use querySelectorAll instead of getElementsByClassName. Created Sept. 30, 2015, 7:56 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « static/img/sprite-index.png ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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];
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))
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
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 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld