mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-25 12:34:47 -04:00
commit
14ecb4a8e4
2 changed files with 48 additions and 0 deletions
38
src/_h5ai/client/js/inc/ext/peer5.js
Normal file
38
src/_h5ai/client/js/inc/ext/peer5.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
modulejs.define('ext/peer5', ['_', '$', 'core/settings'], function (_, $, allsettings) {
|
||||||
|
|
||||||
|
var settings = _.extend({
|
||||||
|
enabled: false,
|
||||||
|
id:'z142i5n5qypq4cxr'
|
||||||
|
}, allsettings.peer5);
|
||||||
|
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
|
||||||
|
if (!settings.enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var peer5js = '//api.peer5.com/peer5.js?id=' + settings.id;
|
||||||
|
//load peer5 with caching
|
||||||
|
$.ajax({
|
||||||
|
url: peer5js,
|
||||||
|
dataType: "script",
|
||||||
|
cache:true
|
||||||
|
});
|
||||||
|
|
||||||
|
//attach to file items, once the DOM is ready
|
||||||
|
$(document).ready(function() {
|
||||||
|
$('body').on('click', '.item.file > a', function (e) {
|
||||||
|
if (window.peer5) {
|
||||||
|
e.preventDefault();
|
||||||
|
var url = e.currentTarget.href;
|
||||||
|
window.peer5.download(url);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
init();
|
||||||
|
});
|
||||||
|
|
|
@ -163,6 +163,16 @@ Options
|
||||||
"useBrowserLang": true
|
"useBrowserLang": true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Adds peer5 p2p downloader which is based on webrtc (see peer5.com)
|
||||||
|
- id: the API key - get your own key - http://peer5.com/downloader
|
||||||
|
*/
|
||||||
|
"peer5": {
|
||||||
|
"enabled": false,
|
||||||
|
"id": "z142i5n5qypq4cxr"
|
||||||
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Adds Piwik tracker javascript code.
|
Adds Piwik tracker javascript code.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue