Skip to content

Commit 6a22728

Browse files
authored
Merge pull request #65 from segment-oj/add-replace-all-for-all-browser-szdytom
Add replace all for all browser
2 parents fc13cdd + 8e15187 commit 6a22728

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

src/StringPrototype.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
if (String.prototype.replaceAll === undefined) {
2+
String.prototype.replaceAll = function (before, after) {
3+
let res = new String(), matched = 0;
4+
for (let i = 0; i < this.length; i += 1) {
5+
if (this[i] == before[matched]) {
6+
matched += 1;
7+
if (matched == before.length) {
8+
res += after;
9+
matched = 0;
10+
}
11+
} else {
12+
matched = 0;
13+
res += this[i];
14+
}
15+
}
16+
return res;
17+
};
18+
}

src/components/problem/content.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div id="problem-view">
33
<div id="content">
4-
<div id="problem-content">
4+
<div id="problem-content" v-loading="problemLoading">
55
<div v-if="!isWider" id="full-screen-button" @click="full_screen()">
66
Expand
77
<i class="el-icon-arrow-right"></i>
@@ -85,7 +85,8 @@ export default {
8585
enable: true,
8686
hidden: false,
8787
time: '-',
88-
memery: '-'
88+
memery: '-',
89+
problemLoading: true
8990
};
9091
},
9192
methods: {
@@ -101,6 +102,7 @@ export default {
101102
this.memery = data.memory_limit / 1000;
102103
this.time = data.time_limit;
103104
this.hidden = !data.enabled;
105+
this.problemLoading = false;
104106
})
105107
.catch(err => {
106108
if(err.request.status === 404) {

src/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ import './assets/css/fontstyle.css';
3535
import './assets/css/basic.css';
3636
import('./loader/load');
3737

38+
import './StringPrototype';
39+
3840
Vue.config.productionTip = false;
3941

4042
new Vue({

0 commit comments

Comments
 (0)