mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-31 23:38:20 -04:00
Clean code.
This commit is contained in:
parent
14ecb4a8e4
commit
cfa46e4512
2 changed files with 14 additions and 11 deletions
|
@ -1,8 +1,8 @@
|
||||||
modulejs.define('ext/peer5', ['_', '$', 'core/settings'], function (_, $, allsettings) {
|
modulejs.define('ext/peer5', ['_', '$', 'core/settings'], function (_, $, allsettings) {
|
||||||
|
|
||||||
var settings = _.extend({
|
var settings = _.extend({
|
||||||
enabled: false,
|
enabled: false,
|
||||||
id:'z142i5n5qypq4cxr'
|
id: 'z142i5n5qypq4cxr'
|
||||||
}, allsettings.peer5);
|
}, allsettings.peer5);
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,16 +13,19 @@ modulejs.define('ext/peer5', ['_', '$', 'core/settings'], function (_, $, allset
|
||||||
}
|
}
|
||||||
|
|
||||||
var peer5js = '//api.peer5.com/peer5.js?id=' + settings.id;
|
var peer5js = '//api.peer5.com/peer5.js?id=' + settings.id;
|
||||||
//load peer5 with caching
|
|
||||||
|
// load peer5 with caching
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: peer5js,
|
url: peer5js,
|
||||||
dataType: "script",
|
dataType: 'script',
|
||||||
cache:true
|
cache:true
|
||||||
});
|
});
|
||||||
|
|
||||||
//attach to file items, once the DOM is ready
|
// attach to file items, once the DOM is ready
|
||||||
$(document).ready(function() {
|
$(function() {
|
||||||
|
|
||||||
$('body').on('click', '.item.file > a', function (e) {
|
$('body').on('click', '.item.file > a', function (e) {
|
||||||
|
|
||||||
if (window.peer5) {
|
if (window.peer5) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var url = e.currentTarget.href;
|
var url = e.currentTarget.href;
|
||||||
|
@ -33,6 +36,6 @@ modulejs.define('ext/peer5', ['_', '$', 'core/settings'], function (_, $, allset
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
init();
|
init();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -163,11 +163,11 @@ Options
|
||||||
"useBrowserLang": true
|
"useBrowserLang": true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Adds peer5 p2p downloader which is based on webrtc (see peer5.com)
|
Adds peer5 p2p downloader which is based on webrtc (see peer5.com).
|
||||||
- id: the API key - get your own key - http://peer5.com/downloader
|
|
||||||
*/
|
- id: the API key - get your own key - http://peer5.com/downloader
|
||||||
|
*/
|
||||||
"peer5": {
|
"peer5": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"id": "z142i5n5qypq4cxr"
|
"id": "z142i5n5qypq4cxr"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue