Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: Tools/GardeningServer/scripts/ui.js

Issue 359283003: Remove usages of jquery and add sugar.js from garden-o-matic. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove jquery script from ct-sheriff-o-matic Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 11 matching lines...) Expand all
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE. 23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 var ui = ui || {}; 26 var ui = ui || {};
27 27
28 (function () { 28 (function () {
29 29
30 ui.displayURLForBuilder = function(builderName) 30 ui.displayURLForBuilder = function(builderName)
31 { 31 {
32 return config.waterfallURL + '?' + $.param({ 32 return config.waterfallURL + '?' + base.queryParam({
33 'builder': builderName 33 'builder': builderName
34 }); 34 });
35 } 35 }
36 36
37 ui.kUseNewWindowForLinksSetting = 'gardenomatic.use-new-window-for-links'; 37 ui.kUseNewWindowForLinksSetting = 'gardenomatic.use-new-window-for-links';
38 38
39 ui.displayNameForBuilder = function(builderName) 39 ui.displayNameForBuilder = function(builderName)
40 { 40 {
41 return builderName.replace(/Webkit /, ''); 41 return builderName.replace(/Webkit /, '');
42 } 42 }
(...skipping 25 matching lines...) Expand all
68 } 68 }
69 69
70 ui.setUseNewWindowForLinks = function(enabled) 70 ui.setUseNewWindowForLinks = function(enabled)
71 { 71 {
72 ui.useNewWindowForLinks = enabled; 72 ui.useNewWindowForLinks = enabled;
73 if (enabled) 73 if (enabled)
74 localStorage[ui.kUseNewWindowForLinksSetting] = 'true'; 74 localStorage[ui.kUseNewWindowForLinksSetting] = 'true';
75 else 75 else
76 delete localStorage[ui.kUseNewWindowForLinksSetting]; 76 delete localStorage[ui.kUseNewWindowForLinksSetting];
77 77
78 $('a').each(function() { 78 [].forEach.call(document.querySelectorAll('a'), function(link) {
79 ui.setTargetForLink(this); 79 ui.setTargetForLink(link);
80 }); 80 });
81 } 81 }
82 ui.setUseNewWindowForLinks(!!localStorage[ui.kUseNewWindowForLinksSetting]); 82 ui.setUseNewWindowForLinks(!!localStorage[ui.kUseNewWindowForLinksSetting]);
83 83
84 ui.createLinkNode = function(url, textContent) 84 ui.createLinkNode = function(url, textContent)
85 { 85 {
86 var link = document.createElement('a'); 86 var link = document.createElement('a');
87 link.href = url; 87 link.href = url;
88 ui.setTargetForLink(link); 88 ui.setTargetForLink(link);
89 link.appendChild(document.createTextNode(textContent)); 89 link.appendChild(document.createTextNode(textContent));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 // When navigating from the browser chrome, we'll 141 // When navigating from the browser chrome, we'll
142 // scroll to the #tabname contents. popstate fires before 142 // scroll to the #tabname contents. popstate fires before
143 // we scroll, so we can save the scroll offset first. 143 // we scroll, so we can save the scroll offset first.
144 window.onpopstate = function() { 144 window.onpopstate = function() {
145 self._saveScrollOffset(); 145 self._saveScrollOffset();
146 }; 146 };
147 }, 147 },
148 _setupLinkSettingHandler: function() 148 _setupLinkSettingHandler: function()
149 { 149 {
150 $('#new-window-for-links').attr('checked', ui.useNewWindowForLinks); 150 if (ui.useNewWindowForLinks)
151 $('#new-window-for-links').change(function(event) { 151 document.getElementById('new-window-for-links').setAttribute('checke d', true);
152 document.getElementById('new-window-for-links').addEventListener('change ', function(event) {
152 ui.setUseNewWindowForLinks(this.checked); 153 ui.setUseNewWindowForLinks(this.checked);
153 }); 154 });
154 }, 155 },
155 attach: function() 156 attach: function()
156 { 157 {
157 document.body.insertBefore(this, document.body.firstChild); 158 document.body.insertBefore(this, document.body.firstChild);
158 this._setupLinkSettingHandler(); 159 this._setupLinkSettingHandler();
159 this._setupHistoryHandlers(); 160 this._setupHistoryHandlers();
160 }, 161 },
161 tabNamed: function(tabName) 162 tabNamed: function(tabName)
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 272
272 revisionsTableNode.appendChild(trNode); 273 revisionsTableNode.appendChild(trNode);
273 }); 274 });
274 275
275 var revisionsNode = document.createElement('details'); 276 var revisionsNode = document.createElement('details');
276 revisionsNode.appendChild(summaryNode); 277 revisionsNode.appendChild(summaryNode);
277 revisionsNode.appendChild(revisionsTableNode); 278 revisionsNode.appendChild(revisionsTableNode);
278 theSpan.appendChild(revisionsNode); 279 theSpan.appendChild(revisionsNode);
279 280
280 // This adds a pop-up when we hover over the summary if the details aren 't being shown. 281 // This adds a pop-up when we hover over the summary if the details aren 't being shown.
281 var revisionsPopUp = $('<span id="revisionPopUp">').appendTo(summaryLink Node); 282 var revisionsPopUp = document.createElement('span')
282 revisionsPopUp.append($(revisionsTableNode).clone()); 283 revisionsPopUp.id = 'revisionPopUp';
283 $(summaryLinkNode).mouseover(function(ev) { 284 summaryLinkNode.appendChild(revisionsPopUp);
285 revisionsPopUp.appendChild(revisionsTableNode.cloneNode(true));
286
287 summaryLinkNode.addEventListener('mouseover', function(event) {
284 if (!revisionsNode.open) { 288 if (!revisionsNode.open) {
285 var tPosX = $(summaryNode).position().left; 289 revisionsPopUp.style.position = 'absolute';
286 var tPosY = $(summaryNode).position().top + 16; 290 revisionsPopUp.style.left = summaryNode.offsetLeft + 'px';
287 $(revisionsPopUp).css({'position': 'absolute', 'top': tPosY, 'le ft': tPosX}); 291 revisionsPopUp.style.top = (summaryNode.offsetTop + summaryNode. offsetHeight) + 'px';
288 $(revisionsPopUp).addClass('active'); 292 revisionsPopUp.classList.add('active');
289 } 293 }
290 }); 294 });
291 $(summaryLinkNode).mouseout(function(ev) { 295
296 summaryLinkNode.addEventListener('mouseout', function(event) {
292 if (!revisionsNode.open) { 297 if (!revisionsNode.open) {
293 $(revisionsPopUp).removeClass("active"); 298 revisionsPopUp.classList.remove("active");
294 } 299 }
295 }); 300 });
296 301
297 var totRevision = model.latestRevision(); 302 var totRevision = model.latestRevision();
298 theSpan.appendChild(document.createTextNode(', trunk is at ')); 303 theSpan.appendChild(document.createTextNode(', trunk is at '));
299 theSpan.appendChild(ui.createLinkNode(trac.changesetURL(totRevision), to tRevision)); 304 theSpan.appendChild(ui.createLinkNode(trac.changesetURL(totRevision), to tRevision));
300
301 // We want this feature, but need to fetch the lastBlinkRollRevision via the interwebs.
302 // Promise.all([checkout.lastBlinkRollRevision(), rollbot.fetchCurrentRo ll()]).then(function(results) {
303 // theSpan.lastRolledRevision = results[0];
304 // theSpan.roll = results[1];
305 // theSpan.updateUI(totRevision);
306 // });
307 } 305 }
308 }); 306 });
309 307
310 })(); 308 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698