Merge pull request #938 from dkanada/query
Remove query string from source
This commit is contained in:
commit
aa5fb12192
5 changed files with 12 additions and 109 deletions
|
@ -61,6 +61,7 @@
|
|||
"material-design-icons-iconfont": "^5.0.1",
|
||||
"native-promise-only": "^0.8.0-a",
|
||||
"page": "^1.11.5",
|
||||
"query-string": "^6.11.1",
|
||||
"resize-observer-polyfill": "^1.5.1",
|
||||
"shaka-player": "^2.5.9",
|
||||
"sortablejs": "^1.10.2",
|
||||
|
|
|
@ -16,6 +16,12 @@ _define("fetch", function() {
|
|||
return fetch
|
||||
});
|
||||
|
||||
// query-string
|
||||
var query = require("query-string");
|
||||
_define("queryString", function() {
|
||||
return query;
|
||||
});
|
||||
|
||||
// flvjs
|
||||
var flvjs = require("flv.js/dist/flv").default;
|
||||
_define("flvjs", function() {
|
||||
|
@ -75,7 +81,7 @@ _define("sortable", function() {
|
|||
// webcomponents
|
||||
var webcomponents = require("webcomponents.js/webcomponents-lite");
|
||||
_define("webcomponents", function() {
|
||||
return webcomponents
|
||||
return webcomponents;
|
||||
});
|
||||
|
||||
// libjass
|
||||
|
@ -97,11 +103,10 @@ _define("material-icons", function() {
|
|||
return material_icons;
|
||||
});
|
||||
|
||||
// Noto Sans
|
||||
|
||||
var jellyfin_noto = require("jellyfin-noto");
|
||||
// noto font
|
||||
var noto = require("jellyfin-noto");
|
||||
_define("jellyfin-noto", function () {
|
||||
return jellyfin_noto;
|
||||
return noto;
|
||||
});
|
||||
|
||||
// page.js
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
"use strict";
|
||||
window.queryString = {}, window.queryString.extract = function(maybeUrl) {
|
||||
return maybeUrl.split("?")[1] || ""
|
||||
}, window.queryString.parse = function(str) {
|
||||
return "string" != typeof str ? {} : (str = str.trim().replace(/^(\?|#|&)/, ""), str ? str.split("&").reduce(function(ret, param) {
|
||||
var parts = param.replace(/\+/g, " ").split("="),
|
||||
key = parts[0],
|
||||
val = parts[1];
|
||||
return key = decodeURIComponent(key), val = void 0 === val ? null : decodeURIComponent(val), ret.hasOwnProperty(key) ? Array.isArray(ret[key]) ? ret[key].push(val) : ret[key] = [ret[key], val] : ret[key] = val, ret
|
||||
}, {}) : {})
|
||||
}, window.queryString.stringify = function(obj) {
|
||||
return obj ? Object.keys(obj).sort().map(function(key) {
|
||||
var val = obj[key];
|
||||
return Array.isArray(val) ? val.sort().map(function(val2) {
|
||||
return encodeURIComponent(key) + "=" + encodeURIComponent(val2)
|
||||
}).join("&") : encodeURIComponent(key) + "=" + encodeURIComponent(val)
|
||||
}).join("&") : ""
|
||||
};
|
|
@ -1,83 +0,0 @@
|
|||
"use strict";
|
||||
var assert = require("assert"),
|
||||
qs = require("./");
|
||||
describe(".parse()", function() {
|
||||
it("query strings starting with a `?`", function() {
|
||||
assert.deepEqual(qs.parse("?foo=bar"), {
|
||||
foo: "bar"
|
||||
})
|
||||
}), it("query strings starting with a `#`", function() {
|
||||
assert.deepEqual(qs.parse("#foo=bar"), {
|
||||
foo: "bar"
|
||||
})
|
||||
}), it("query strings starting with a `&", function() {
|
||||
assert.deepEqual(qs.parse("&foo=bar&foo=baz"), {
|
||||
foo: ["bar", "baz"]
|
||||
})
|
||||
}), it("parse a query string", function() {
|
||||
assert.deepEqual(qs.parse("foo=bar"), {
|
||||
foo: "bar"
|
||||
})
|
||||
}), it("parse multiple query string", function() {
|
||||
assert.deepEqual(qs.parse("foo=bar&key=val"), {
|
||||
foo: "bar",
|
||||
key: "val"
|
||||
})
|
||||
}), it("parse query string without a value", function() {
|
||||
assert.deepEqual(qs.parse("foo"), {
|
||||
foo: null
|
||||
}), assert.deepEqual(qs.parse("foo&key"), {
|
||||
foo: null,
|
||||
key: null
|
||||
}), assert.deepEqual(qs.parse("foo=bar&key"), {
|
||||
foo: "bar",
|
||||
key: null
|
||||
})
|
||||
}), it("return empty object if no qss can be found", function() {
|
||||
assert.deepEqual(qs.parse("?"), {}), assert.deepEqual(qs.parse("&"), {}), assert.deepEqual(qs.parse("#"), {}), assert.deepEqual(qs.parse(" "), {})
|
||||
}), it("handle `+` correctly", function() {
|
||||
assert.deepEqual(qs.parse("foo+faz=bar+baz++"), {
|
||||
"foo faz": "bar baz "
|
||||
})
|
||||
}), it("handle multiple of the same key", function() {
|
||||
assert.deepEqual(qs.parse("foo=bar&foo=baz"), {
|
||||
foo: ["bar", "baz"]
|
||||
})
|
||||
}), it("query strings params including embedded `=`", function() {
|
||||
assert.deepEqual(qs.parse("?param=http%3A%2F%2Fsomeurl%3Fid%3D2837"), {
|
||||
param: "http://someurl?id=2837"
|
||||
})
|
||||
})
|
||||
}), describe(".stringify()", function() {
|
||||
it("stringify", function() {
|
||||
assert.strictEqual(qs.stringify({
|
||||
foo: "bar"
|
||||
}), "foo=bar"), assert.strictEqual(qs.stringify({
|
||||
foo: "bar",
|
||||
bar: "baz"
|
||||
}), "bar=baz&foo=bar")
|
||||
}), it("different types", function() {
|
||||
assert.strictEqual(qs.stringify(), ""), assert.strictEqual(qs.stringify(0), "")
|
||||
}), it("URI encode", function() {
|
||||
assert.strictEqual(qs.stringify({
|
||||
"foo bar": "baz faz"
|
||||
}), "foo%20bar=baz%20faz")
|
||||
}), it("handle array value", function() {
|
||||
assert.strictEqual(qs.stringify({
|
||||
abc: "abc",
|
||||
foo: ["bar", "baz"]
|
||||
}), "abc=abc&foo=bar&foo=baz")
|
||||
})
|
||||
}), describe(".extract()", function() {
|
||||
it("should extract qs from url", function() {
|
||||
assert.equal(qs.extract("http://foo.bar/?abc=def&hij=klm"), "abc=def&hij=klm"), assert.equal(qs.extract("http://foo.bar/?"), "")
|
||||
}), it("should handle strings not containing qs", function() {
|
||||
assert.equal(qs.extract("http://foo.bar/"), ""), assert.equal(qs.extract(""), "")
|
||||
}), it("should throw for invalid values", function() {
|
||||
assert.throws(function() {
|
||||
qs.extract(null)
|
||||
}, TypeError), assert.throws(function() {
|
||||
qs.extract(void 0)
|
||||
}, TypeError)
|
||||
})
|
||||
});
|
|
@ -733,6 +733,7 @@ var AppInfo = {};
|
|||
"resize-observer-polyfill",
|
||||
"shaka",
|
||||
"swiper",
|
||||
"queryString",
|
||||
"sortable",
|
||||
"libjass",
|
||||
"webcomponents",
|
||||
|
@ -798,9 +799,6 @@ var AppInfo = {};
|
|||
define("headroom", [componentsPath + "/headroom/headroom"], returnFirstDependency);
|
||||
define("scroller", [componentsPath + "/scroller"], returnFirstDependency);
|
||||
define("navdrawer", [componentsPath + "/navdrawer/navdrawer"], returnFirstDependency);
|
||||
define("queryString", [bowerPath + "/query-string/index"], function () {
|
||||
return queryString;
|
||||
});
|
||||
|
||||
define("emby-button", [elementsPath + "/emby-button/emby-button"], returnFirstDependency);
|
||||
define("paper-icon-button-light", [elementsPath + "/emby-button/paper-icon-button-light"], returnFirstDependency);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue