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

Side by Side Diff: lib/ui.js

Issue 5325266087837696: Issue 1675 - Use String.trim() to strip leading and trailing whitespaces (Firefox) (Closed)
Patch Set: Created Dec. 8, 2014, 5:24 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/filterClasses.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 if (!title) 947 if (!title)
948 title = url; 948 title = url;
949 949
950 // Main subscription needs both title and URL 950 // Main subscription needs both title and URL
951 if (mainSubscriptionTitle && !mainSubscriptionURL) 951 if (mainSubscriptionTitle && !mainSubscriptionURL)
952 mainSubscriptionTitle = null; 952 mainSubscriptionTitle = null;
953 if (mainSubscriptionURL && !mainSubscriptionTitle) 953 if (mainSubscriptionURL && !mainSubscriptionTitle)
954 mainSubscriptionURL = null; 954 mainSubscriptionURL = null;
955 955
956 // Trim spaces in title and URL 956 // Trim spaces in title and URL
957 title = title.replace(/^\s+/, "").replace(/\s+$/, ""); 957 title = title.trim();
958 url = url.replace(/^\s+/, "").replace(/\s+$/, ""); 958 url = url.trim();
959 if (mainSubscriptionURL) 959 if (mainSubscriptionURL)
960 { 960 {
961 mainSubscriptionTitle = mainSubscriptionTitle.replace(/^\s+/, "").replace( /\s+$/, ""); 961 mainSubscriptionTitle = mainSubscriptionTitle.trim();
962 mainSubscriptionURL = mainSubscriptionURL.replace(/^\s+/, "").replace(/\s+ $/, ""); 962 mainSubscriptionURL = mainSubscriptionURL.trim();
963 } 963 }
964 964
965 // Verify that the URL is valid 965 // Verify that the URL is valid
966 url = Utils.makeURI(url); 966 url = Utils.makeURI(url);
967 if (!url || (url.scheme != "http" && url.scheme != "https" && url.scheme != "ftp")) 967 if (!url || (url.scheme != "http" && url.scheme != "https" && url.scheme != "ftp"))
968 return; 968 return;
969 url = url.spec; 969 url = url.spec;
970 970
971 if (mainSubscriptionURL) 971 if (mainSubscriptionURL)
972 { 972 {
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
1953 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)], 1953 ["abp-command-contribute", "command", UI.openContributePage.bind(UI)],
1954 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)] 1954 ["abp-command-contribute-hide", "command", UI.hideContributeButton.bind(UI)]
1955 ]; 1955 ];
1956 1956
1957 onShutdown.add(function() 1957 onShutdown.add(function()
1958 { 1958 {
1959 for (let window in UI.applicationWindows) 1959 for (let window in UI.applicationWindows)
1960 if (UI.isBottombarOpen(window)) 1960 if (UI.isBottombarOpen(window))
1961 UI.toggleBottombar(window); 1961 UI.toggleBottombar(window);
1962 }); 1962 });
OLDNEW
« no previous file with comments | « lib/filterClasses.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld