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

Side by Side Diff: chrome/browser/resources/md_downloads/crisper.js

Issue 2337513002: Only handle click actions for left & middle buttons (Closed)
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 function assert(condition, opt_message) { 4 function assert(condition, opt_message) {
5 if (!condition) { 5 if (!condition) {
6 var message = 'Assertion failed'; 6 var message = 'Assertion failed';
7 if (opt_message) message = message + ': ' + opt_message; 7 if (opt_message) message = message + ': ' + opt_message;
8 var error = new Error(message); 8 var error = new Error(message);
9 var global = function() { 9 var global = function() {
10 return this; 10 return this;
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 return assertInstanceof($(id), HTMLElement, 'Missing required element: ' + id) ; 641 return assertInstanceof($(id), HTMLElement, 'Missing required element: ' + id) ;
642 } 642 }
643 643
644 function queryRequiredElement(selectors, opt_context) { 644 function queryRequiredElement(selectors, opt_context) {
645 var element = (opt_context || document).querySelector(selectors); 645 var element = (opt_context || document).querySelector(selectors);
646 return assertInstanceof(element, HTMLElement, 'Missing required element: ' + s electors); 646 return assertInstanceof(element, HTMLElement, 'Missing required element: ' + s electors);
647 } 647 }
648 648
649 [ 'click', 'auxclick' ].forEach(function(eventName) { 649 [ 'click', 'auxclick' ].forEach(function(eventName) {
650 document.addEventListener(eventName, function(e) { 650 document.addEventListener(eventName, function(e) {
651 if (e.button !== 0 && e.button !== 1)
652 return; // Ignore buttons other than left and middle.
Dan Beam 2016/09/12 19:18:59 this is a generated file you need to update ui/we
Navid Zolghadr 2016/09/12 19:50:09 Umm. That is weird. Because I changed this file in
Dan Beam 2016/09/12 21:25:32 you changed both util.js and crisper.js in similar
651 if (e.defaultPrevented) return; 653 if (e.defaultPrevented) return;
652 var eventPath = e.path; 654 var eventPath = e.path;
653 var anchor = null; 655 var anchor = null;
654 if (eventPath) { 656 if (eventPath) {
655 for (var i = 0; i < eventPath.length; i++) { 657 for (var i = 0; i < eventPath.length; i++) {
656 var element = eventPath[i]; 658 var element = eventPath[i];
657 if (element.tagName === 'A' && element.href) { 659 if (element.tagName === 'A' && element.href) {
658 anchor = element; 660 anchor = element;
659 break; 661 break;
660 } 662 }
(...skipping 6295 matching lines...) Expand 10 before | Expand all | Expand 10 after
6956 Manager.get().updateItem_(index, data); 6958 Manager.get().updateItem_(index, data);
6957 }; 6959 };
6958 return { 6960 return {
6959 Manager: Manager 6961 Manager: Manager
6960 }; 6962 };
6961 }); 6963 });
6962 6964
6963 // Copyright 2015 The Chromium Authors. All rights reserved. 6965 // Copyright 2015 The Chromium Authors. All rights reserved.
6964 // Use of this source code is governed by a BSD-style license that can be 6966 // Use of this source code is governed by a BSD-style license that can be
6965 // found in the LICENSE file. 6967 // found in the LICENSE file.
6966 window.addEventListener('load', downloads.Manager.onLoad); 6968 window.addEventListener('load', downloads.Manager.onLoad);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698