* Compatible with IE.

This commit is contained in:
caoyanyi
2023-03-30 08:30:17 +08:00
parent 9f19893d26
commit b883f56dfc
3 changed files with 11 additions and 11 deletions
+4 -4
View File
@@ -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);
});
+4 -4
View File
@@ -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);
});
+3 -3
View File
@@ -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));
});