cleanup: Replace deprecated String.prototype.substr()
The method is documented as deprecated: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/substr Switch to the non-deprecated substring() method. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3234>
This commit is contained in:
parent
193b6c129e
commit
df50c2dfc6
@ -62,6 +62,6 @@ export function loadSubInterfaceXML(iface, ifaceFile) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
xmlHeader +
|
xmlHeader +
|
||||||
xml.substr(ifaceStartIndex, ifaceEndIndex - ifaceStartIndex) +
|
xml.substring(ifaceStartIndex, ifaceEndIndex) +
|
||||||
xmlFooter);
|
xmlFooter);
|
||||||
}
|
}
|
||||||
|
@ -319,7 +319,7 @@ class DBusEventSource extends EventSourceBase {
|
|||||||
let event = new CalendarEvent(id, date, end, summary);
|
let event = new CalendarEvent(id, date, end, summary);
|
||||||
/* It's a recurring event */
|
/* It's a recurring event */
|
||||||
if (!id.endsWith('\n')) {
|
if (!id.endsWith('\n')) {
|
||||||
const parentId = id.substr(0, id.lastIndexOf('\n') + 1);
|
const parentId = id.substring(0, id.lastIndexOf('\n') + 1);
|
||||||
if (!handledRemovals.has(parentId)) {
|
if (!handledRemovals.has(parentId)) {
|
||||||
handledRemovals.add(parentId);
|
handledRemovals.add(parentId);
|
||||||
this._removeMatching(parentId);
|
this._removeMatching(parentId);
|
||||||
|
@ -57,7 +57,7 @@ class URLHighlighter extends St.Label {
|
|||||||
this.connect('style-changed', () => {
|
this.connect('style-changed', () => {
|
||||||
let [hasColor, color] = this.get_theme_node().lookup_color('link-color', false);
|
let [hasColor, color] = this.get_theme_node().lookup_color('link-color', false);
|
||||||
if (hasColor) {
|
if (hasColor) {
|
||||||
let linkColor = color.to_string().substr(0, 7);
|
let linkColor = color.to_string().substring(0, 7);
|
||||||
if (linkColor !== this._linkColor) {
|
if (linkColor !== this._linkColor) {
|
||||||
this._linkColor = linkColor;
|
this._linkColor = linkColor;
|
||||||
this._highlightUrls();
|
this._highlightUrls();
|
||||||
@ -143,11 +143,11 @@ class URLHighlighter extends St.Label {
|
|||||||
let pos = 0;
|
let pos = 0;
|
||||||
for (let i = 0; i < urls.length; i++) {
|
for (let i = 0; i < urls.length; i++) {
|
||||||
let url = urls[i];
|
let url = urls[i];
|
||||||
let str = this._text.substr(pos, url.pos - pos);
|
let str = this._text.substring(pos, url.pos);
|
||||||
markup += `${str}<span foreground="${this._linkColor}"><u>${url.url}</u></span>`;
|
markup += `${str}<span foreground="${this._linkColor}"><u>${url.url}</u></span>`;
|
||||||
pos = url.pos + url.url.length;
|
pos = url.pos + url.url.length;
|
||||||
}
|
}
|
||||||
markup += this._text.substr(pos);
|
markup += this._text.substring(pos);
|
||||||
this.clutter_text.set_markup(markup);
|
this.clutter_text.set_markup(markup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ class RunDialog extends ModalDialog.ModalDialog {
|
|||||||
if (text.lastIndexOf(' ') === -1)
|
if (text.lastIndexOf(' ') === -1)
|
||||||
prefix = text;
|
prefix = text;
|
||||||
else
|
else
|
||||||
prefix = text.substr(text.lastIndexOf(' ') + 1);
|
prefix = text.substring(text.lastIndexOf(' ') + 1);
|
||||||
let postfix = this._getCompletion(prefix);
|
let postfix = this._getCompletion(prefix);
|
||||||
if (postfix != null && postfix.length > 0) {
|
if (postfix != null && postfix.length > 0) {
|
||||||
o.insert_text(postfix, -1);
|
o.insert_text(postfix, -1);
|
||||||
@ -143,7 +143,7 @@ class RunDialog extends ModalDialog.ModalDialog {
|
|||||||
}
|
}
|
||||||
if (k === 0)
|
if (k === 0)
|
||||||
return '';
|
return '';
|
||||||
return s1.substr(0, k);
|
return s1.substring(0, k);
|
||||||
}
|
}
|
||||||
|
|
||||||
let paths = GLib.getenv('PATH').split(':');
|
let paths = GLib.getenv('PATH').split(':');
|
||||||
@ -172,7 +172,7 @@ class RunDialog extends ModalDialog.ModalDialog {
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
let common = results.reduce(_getCommon, null);
|
let common = results.reduce(_getCommon, null);
|
||||||
return common.substr(text.length);
|
return common.substring(text.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
_getCompletion(text) {
|
_getCompletion(text) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user