Skip to content

Commit f915957

Browse files
committed
refactor: replace js-url with wurl (original version of js-url)
Signed-off-by: BoHong Li <a60814billy@gmail.com>
1 parent 651c11f commit f915957

5 files changed

Lines changed: 23 additions & 224 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"jquery-mousewheel": "^3.1.13",
5858
"jquery-ui": "^1.12.1",
5959
"js-cookie": "^2.1.3",
60-
"js-url": "^2.3.0",
6160
"js-yaml": "^3.7.0",
6261
"jsdom-nogyp": "^0.8.3",
6362
"keymaster": "^1.6.2",
@@ -130,6 +129,7 @@
130129
"viz.js": "^1.7.0",
131130
"winston": "^3.1.0",
132131
"ws": "^6.0.0",
132+
"wurl": "^2.5.3",
133133
"xss": "^1.0.3"
134134
},
135135
"resolutions": {

public/js/history.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import store from 'store'
55
import S from 'string'
66
import LZString from 'lz-string'
77

8+
import wurl from 'wurl'
9+
810
import {
911
checkNoteIdValid,
1012
encodeNoteId
@@ -23,9 +25,9 @@ window.migrateHistoryFromTempCallback = null
2325
migrateHistoryFromTemp()
2426

2527
function migrateHistoryFromTemp () {
26-
if (window.url('#tempid')) {
28+
if (wurl('#tempid')) {
2729
$.get(`${serverurl}/temp`, {
28-
tempid: window.url('#tempid')
30+
tempid: wurl('#tempid')
2931
})
3032
.done(data => {
3133
if (data && data.temp) {

public/js/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import hljs from 'highlight.js'
2020

2121
import _ from 'lodash'
2222

23+
import wurl from 'wurl'
24+
2325
import List from 'list.js'
2426

2527
import Idle from '@hackmd/idle-js'
@@ -1390,12 +1392,12 @@ $('#gistImportModalConfirm').click(function () {
13901392
if (!isValidURL(gisturl)) {
13911393
showMessageModal('<i class="fa fa-github"></i> Import from Gist', 'Not a valid URL :(', '', '', false)
13921394
} else {
1393-
var hostname = window.url('hostname', gisturl)
1395+
var hostname = wurl('hostname', gisturl)
13941396
if (hostname !== 'gist.github.com') {
13951397
showMessageModal('<i class="fa fa-github"></i> Import from Gist', 'Not a valid Gist URL :(', '', '', false)
13961398
} else {
13971399
ui.spinner.show()
1398-
$.get('https://api.github.com/gists/' + window.url('-1', gisturl))
1400+
$.get('https://api.github.com/gists/' + wurl('-1', gisturl))
13991401
.done(function (data) {
14001402
if (data.files) {
14011403
var contents = ''

webpack.common.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,11 @@ module.exports = {
195195
'bootstrap-validator',
196196
'expose-loader?select2!select2',
197197
'expose-loader?moment!moment',
198-
'script-loader!js-url',
199198
path.join(__dirname, 'public/js/cover.js')
200199
],
201200
index: [
202201
'babel-polyfill',
203202
'script-loader!jquery-ui-resizable',
204-
'script-loader!js-url',
205203
'expose-loader?LZString!lz-string',
206204
'script-loader!codemirror',
207205
'script-loader!inlineAttachment',
@@ -247,7 +245,6 @@ module.exports = {
247245
'expose-loader?jsyaml!js-yaml',
248246
'script-loader!mermaid',
249247
'expose-loader?moment!moment',
250-
'script-loader!js-url',
251248
'script-loader!handlebars',
252249
'expose-loader?hljs!highlight.js',
253250
'expose-loader?emojify!emojify.js',

0 commit comments

Comments
 (0)