From b883f56dfcbd0e2fa9083922a63449cbb5aeaaa9 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Thu, 30 Mar 2023 08:30:17 +0800 Subject: [PATCH] * Compatible with IE. --- module/mr/js/diff.js | 8 ++++---- module/repo/js/diff.js | 8 ++++---- module/repo/js/monaco.js | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/module/mr/js/diff.js b/module/mr/js/diff.js index 791a2225a1..37a53877c1 100644 --- a/module/mr/js/diff.js +++ b/module/mr/js/diff.js @@ -133,7 +133,7 @@ function getDiffs(fileName) function createTab(filename, filepath) { $('[data-path="' + decodeURIComponent(filepath) + '"]').closest('li').addClass('selected'); - var tabID = Base64.encode(filepath).replaceAll('=', '-'); + var tabID = Base64.encode(filepath).replace(/=/g, '-'); return { title: filename, id: tabID, @@ -200,7 +200,7 @@ $(document).ready(function() /* Remove file path for opened files. */ $('#fileTabs').on('onClose', function(event, tab) { - var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '='))); + var filepath = decodeURIComponent(Base64.decode(tab.id.replace(/-/g, '='))); var index = openedFiles.indexOf(filepath); if(index > -1) { @@ -213,7 +213,7 @@ $(document).ready(function() /* Append file path into the title. */ $('#fileTabs').on('onLoad', function(event, tab) { - var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '='))); + var filepath = decodeURIComponent(Base64.decode(tab.id.replace(/-/g, '='))); $('#tab-nav-item-' + tab.id).attr('title', filepath); document.getElementById('tab-iframe-' + tab.id).contentWindow.updateEditorInline(diffAppose); @@ -221,7 +221,7 @@ $(document).ready(function() }); $('#fileTabs').on('onOpen', function(event, tab) { - var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '='))); + var filepath = decodeURIComponent(Base64.decode(tab.id.replace(/-/g, '='))); var index = openedFiles.indexOf(filepath); if(index > -1) document.getElementById('tab-iframe-' + tab.id).contentWindow.updateEditorInline(diffAppose); }); diff --git a/module/repo/js/diff.js b/module/repo/js/diff.js index 69df534fe1..dce31d6709 100644 --- a/module/repo/js/diff.js +++ b/module/repo/js/diff.js @@ -84,7 +84,7 @@ function getDiffs(fileName) function createTab(filename, filepath) { $('[data-path="' + decodeURIComponent(filepath) + '"]').closest('li').addClass('selected'); - var tabID = Base64.encode(filepath).replaceAll('=', '-'); + var tabID = Base64.encode(filepath).replace(/=/g, '-'); return { id: tabID, url: createLink('repo', 'ajaxGetDiffEditorContent', urlParams.replace('%s', Base64.encode(encodeURIComponent(filepath)))), @@ -141,7 +141,7 @@ $(document).ready(function() /* Remove file path for opened files. */ $('#fileTabs').on('onClose', function(event, tab) { - var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '='))); + var filepath = decodeURIComponent(Base64.decode(tab.id.replace(/-/g, '='))); var index = openedFiles.indexOf(filepath); if(index > -1) { @@ -154,7 +154,7 @@ $(document).ready(function() /* Append file path into the title. */ $('#fileTabs').on('onLoad', function(event, tab) { - var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '='))); + var filepath = decodeURIComponent(Base64.decode(tab.id.replace(/-/g, '='))); $('#tab-nav-item-' + tab.id).attr('title', filepath); document.getElementById('tab-iframe-' + tab.id).contentWindow.updateEditorInline(diffAppose); @@ -162,7 +162,7 @@ $(document).ready(function() }); $('#fileTabs').on('onOpen', function(event, tab) { - var filepath = decodeURIComponent(Base64.decode(tab.id.replaceAll('-', '='))); + var filepath = decodeURIComponent(Base64.decode(tab.id.replace(/-/g, '='))); var index = openedFiles.indexOf(filepath); if(index > -1) document.getElementById('tab-iframe-' + tab.id).contentWindow.updateEditorInline(diffAppose); }); diff --git a/module/repo/js/monaco.js b/module/repo/js/monaco.js index 16015dc2aa..9f0a7971f9 100644 --- a/module/repo/js/monaco.js +++ b/module/repo/js/monaco.js @@ -10,7 +10,7 @@ function createTab(filename, filepath) { $('[data-path="' + decodeURIComponent(filepath) + '"]').closest('li').addClass('selected'); /* encode twice for resolving chinese character. */ - var tabID = Base64.encode(Base64.encode(filepath).replaceAll('=', '-')).replaceAll('=', '-'); + var tabID = Base64.encode(Base64.encode(filepath).replace(/=/g, '-')).replace(/=/g, '-'); return { id: tabID, url: createLink('repo', 'ajaxGetEditorContent', urlParams.replace('%s', Base64.encode(encodeURIComponent(filepath)))), @@ -58,7 +58,7 @@ $(function() /* Remove file path for opened files. */ $('#fileTabs').on('onClose', function(event, tab) { /* encode twice for resolving chinese character. */ - var filepath = decodeURIComponent(Base64.decode(Base64.decode(tab.id.replaceAll('-', '=')).replaceAll('-', '='))); + var filepath = decodeURIComponent(Base64.decode(Base64.decode(tab.id.replace(/-/g, '=')).replace(/-/g, '='))); var index = openedFiles.indexOf(filepath); if(index > -1) { @@ -71,7 +71,7 @@ $(function() /* Append file path into the title. */ $('#fileTabs').on('onLoad', function(event, tab) { - var filepath = Base64.decode(tab.id.replaceAll('-', '=')); + var filepath = Base64.decode(tab.id.replace(/-/g, '=')); $('#tab-nav-item-' + tab.id).attr('title', decodeURIComponent(filepath)); });