1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

update components

This commit is contained in:
Luke Pulverenti 2016-02-03 18:00:01 -05:00
parent 59ea1c2f7d
commit cf577ba8eb
1136 changed files with 59263 additions and 576 deletions

View file

@ -0,0 +1,151 @@
(function() {
if ( !self.Prism || !self.document || !document.querySelectorAll || ![].filter) return;
var adapters = [];
function registerAdapter(adapter) {
if (typeof adapter === "function" && !getAdapter(adapter)) {
adapters.push(adapter);
}
}
function getAdapter(adapter) {
if (typeof adapter === "function") {
return adapters.filter(function(fn) { return fn.valueOf() === adapter.valueOf()})[0];
}
else if (typeof adapter === "string" && adapter.length > 0) {
return adapters.filter(function(fn) { return fn.name === adapter})[0];
}
return null;
}
function removeAdapter(adapter) {
if (typeof adapter === "string")
adapter = getAdapter(adapter);
if (typeof adapter === "function") {
var index = adapters.indexOf(adapter);
if (index >=0) {
adapters.splice(index,1);
}
}
}
Prism.plugins.jsonphighlight = {
registerAdapter: registerAdapter,
removeAdapter: removeAdapter,
highlight: highlight
};
registerAdapter(function github(rsp, el) {
if ( rsp && rsp.meta && rsp.data ) {
if ( rsp.meta.status && rsp.meta.status >= 400 ) {
return "Error: " + ( rsp.data.message || rsp.meta.status );
}
else if ( typeof(rsp.data.content) === "string" ) {
return typeof(atob) === "function"
? atob(rsp.data.content.replace(/\s/g, ""))
: "Your browser cannot decode base64";
}
}
return null;
});
registerAdapter(function gist(rsp, el) {
if ( rsp && rsp.meta && rsp.data && rsp.data.files ) {
if ( rsp.meta.status && rsp.meta.status >= 400 ) {
return "Error: " + ( rsp.data.message || rsp.meta.status );
}
else {
var filename = el.getAttribute("data-filename");
if (filename == null) {
// Maybe in the future we can somehow render all files
// But the standard <script> include for gists does that nicely already,
// so that might be getting beyond the scope of this plugin
for (var key in rsp.data.files) {
if (rsp.data.files.hasOwnProperty(key)) {
filename = key;
break;
}
}
}
if (rsp.data.files[filename] !== undefined) {
return rsp.data.files[filename].content;
}
else {
return "Error: unknown or missing gist file " + filename;
}
}
}
return null;
});
registerAdapter(function bitbucket(rsp, el) {
return rsp && rsp.node && typeof(rsp.data) === "string"
? rsp.data
: null;
});
var jsonpcb = 0,
loadstr = "Loading…";
function highlight() {
Array.prototype.slice.call(document.querySelectorAll("pre[data-jsonp]")).forEach(function(pre) {
pre.textContent = "";
var code = document.createElement("code");
code.textContent = loadstr;
pre.appendChild(code);
var adapterfn = pre.getAttribute("data-adapter");
var adapter = null;
if ( adapterfn ) {
if ( typeof(window[adapterfn]) === "function" ) {
adapter = window[adapterfn];
}
else {
code.textContent = "JSONP adapter function '" + adapterfn + "' doesn't exist";
return;
}
}
var cb = "prismjsonp" + ( jsonpcb++ );
var uri = document.createElement("a");
var src = uri.href = pre.getAttribute("data-jsonp");
uri.href += ( uri.search ? "&" : "?" ) + ( pre.getAttribute("data-callback") || "callback" ) + "=" + cb;
var timeout = setTimeout(function() {
// we could clean up window[cb], but if the request finally succeeds, keeping it around is a good thing
if ( code.textContent === loadstr )
code.textContent = "Timeout loading '" + src + "'";
}, 5000);
var script = document.createElement("script");
script.src = uri.href;
window[cb] = function(rsp) {
document.head.removeChild(script);
clearTimeout(timeout);
delete window[cb];
var data = "";
if ( adapter ) {
data = adapter(rsp, pre);
}
else {
for ( var p in adapters ) {
data = adapters[p](rsp, pre);
if ( data !== null ) break;
}
}
if (data === null) {
code.textContent = "Cannot parse response (perhaps you need an adapter function?)";
}
else {
code.textContent = data;
Prism.highlightElement(code);
}
};
document.head.appendChild(script);
});
}
highlight();
})();

View file

@ -0,0 +1 @@
!function(){function t(t){"function"!=typeof t||e(t)||r.push(t)}function e(t){return"function"==typeof t?r.filter(function(e){return e.valueOf()===t.valueOf()})[0]:"string"==typeof t&&t.length>0?r.filter(function(e){return e.name===t})[0]:null}function n(t){if("string"==typeof t&&(t=e(t)),"function"==typeof t){var n=r.indexOf(t);n>=0&&r.splice(n,1)}}function a(){Array.prototype.slice.call(document.querySelectorAll("pre[data-jsonp]")).forEach(function(t){t.textContent="";var e=document.createElement("code");e.textContent=i,t.appendChild(e);var n=t.getAttribute("data-adapter"),a=null;if(n){if("function"!=typeof window[n])return e.textContent="JSONP adapter function '"+n+"' doesn't exist",void 0;a=window[n]}var u="prismjsonp"+o++,f=document.createElement("a"),l=f.href=t.getAttribute("data-jsonp");f.href+=(f.search?"&":"?")+(t.getAttribute("data-callback")||"callback")+"="+u;var s=setTimeout(function(){e.textContent===i&&(e.textContent="Timeout loading '"+l+"'")},5e3),d=document.createElement("script");d.src=f.href,window[u]=function(n){document.head.removeChild(d),clearTimeout(s),delete window[u];var o="";if(a)o=a(n,t);else for(var i in r)if(o=r[i](n,t),null!==o)break;null===o?e.textContent="Cannot parse response (perhaps you need an adapter function?)":(e.textContent=o,Prism.highlightElement(e))},document.head.appendChild(d)})}if(self.Prism&&self.document&&document.querySelectorAll&&[].filter){var r=[];Prism.plugins.jsonphighlight={registerAdapter:t,removeAdapter:n,highlight:a},t(function(t){if(t&&t.meta&&t.data){if(t.meta.status&&t.meta.status>=400)return"Error: "+(t.data.message||t.meta.status);if("string"==typeof t.data.content)return"function"==typeof atob?atob(t.data.content.replace(/\s/g,"")):"Your browser cannot decode base64"}return null}),t(function(t,e){if(t&&t.meta&&t.data&&t.data.files){if(t.meta.status&&t.meta.status>=400)return"Error: "+(t.data.message||t.meta.status);var n=e.getAttribute("data-filename");if(null==n)for(var a in t.data.files)if(t.data.files.hasOwnProperty(a)){n=a;break}return void 0!==t.data.files[n]?t.data.files[n].content:"Error: unknown or missing gist file "+n}return null}),t(function(t){return t&&t.node&&"string"==typeof t.data?t.data:null});var o=0,i="Loading…";a()}}();