first commit

This commit is contained in:
2024-11-10 21:08:49 +01:00
commit 0d932ce5ee
14455 changed files with 2567501 additions and 0 deletions

View File

@@ -0,0 +1,209 @@
var wpfdColorboxInit;
jQuery(document).ready(function ($) {
var videoTypes = ['m4a', 'mp4', 'webm', 'ogg', 'ogv', 'flv'];
var audioTypes = ['mp3', 'wav', 'wma'];
var imageTypes = ['jpg', 'png', 'gif', 'jpeg', 'jpe', 'bmp', 'ico', 'tiff', 'tif', 'svg', 'svgz'];
(wpfdColorboxInit = function () {
// $('.wpfdlightbox').colorbox({iframe:true, innerWidth:'90%', innerHeight:'90%',maxWidth:'90%',maxHeight:'90%'});
$('.wpfdlightbox').each(function () {
var filetype = $(this).data('file-type');
sW = $(window).width();
sH = $(window).height();
sR = sW / sH;
$(this).unbind('click').click(function (e) {
e.preventDefault();
fileid = $(this).data('id');
catid = $(this).data('catid');
downloadLink = wpfdcolorbox.ajaxurl + 'action=wpfd&task=file.download&wpfd_category_id=' + catid + '&wpfd_file_id=' + fileid + '&preview=1';
if ($(this).hasClass('wpfd_previewlink')) {
var href = jQuery(this).attr('href');
// var href = decodeURIComponent(jQuery(this).attr('href'));
// href = href.replace('docs.google.com/viewer?url=', '');
var extLink = href.replace(/^https?\:\/\//i, '');
if (typeof _gaq != 'undefined') {
_gaq.push(['_trackEvent', 'WPFD', 'Preview', extLink]);
}
}
if (typeof fileid == 'string') {
while (fileid.indexOf(':') > -1) {
fileid = fileid.replace(':', '-');
}
}
html = '<div class="dropblock">';
if (audioTypes.indexOf(filetype) > -1) { //is audio
html += '<audio src="' + downloadLink + '" class="video-js vjs-default-skin" id="player-' + fileid + '" controls="controls" preload="auto" autoplay="true"> ';
html += ' <p class="vjs-no-js">Your browser does not support the <code>audio</code> element.</p></audio>';
} else if (imageTypes.indexOf(filetype) > -1) { //is image
html += '<img src="' + downloadLink + '" class="video-js vjs-default-skin" id="player-' + fileid + '" /> ';
} else if (videoTypes.indexOf(filetype) > -1) {
html += '<video width="1000" height="1000" src="' + downloadLink + '" class="video-js vjs-default-skin" id="player-' + fileid + '" controls="controls" preload="auto" autoplay="true"> ';
html += ' <p class="vjs-no-js">Your browser does not support the <code>video</code> element.</p></video>';
} else { //other type
viewlink = $(this).attr('href');
//googleViewer = 'https://docs.google.com/viewer?url='+ encodeURIComponent(encodeURI(viewlink))+'&embedded=true';
html += '<iframe mozallowfullscreen="true" webkitallowfullscreen="true" allowfullscreen="true" class="cboxIframe" src="' + viewlink + '" frameborder="0"></iframe>';
}
html += '</div>';
//loader init
loader = $("#wpfd-box-loading");
if (loader.length === 0) {
$('body').append('<div id="wpfd-box-loading" style="display: hidden;"><div class="loading"></div></div>');
loader = $("#wpfd-box-loading");
}
loader.show();
//player box init
pBox = $("#wpfd-box-player");
if (pBox.length === 0) {
$('body').append('<div id="wpfd-box-player" style="display: hidden;"></div>');
pBox = $("#wpfd-box-player");
}
pBox.hide();
pBox.empty();
pBox.prepend(html);
pBox.click(function (e) {
if ($(e.target).is('#wpfd-box-player')) {
pBox.hide();
if ($("#player-" + fileid).length) {
myPlayer = videojs("player-" + fileid);
myPlayer.dispose();
}
}
$('#wpfd-box-player').unbind('click.box').bind('click.box', function (e) {
if ($(e.target).is('#wpfd-box-player')) {
pBox.hide();
}
});
});
//player
if (imageTypes.indexOf(filetype) > -1) { //is image
new_img = new Image();
new_img.onload = function () {
var img_width = this.width,
img_heigth = this.height;
vR = img_width / img_heigth;
if (vR > sR) {
new_vW = parseInt(sW * 0.9);
new_vH = parseInt(new_vW / vR);
} else {
new_vH = parseInt(sH * 0.9);
new_vW = parseInt(new_vH * vR);
}
if (new_vW > img_width && new_vH > img_heigth) {
new_vW = img_width;
new_vH = img_heigth;
}
$("#player-" + fileid).css('width', new_vW);
$("#player-" + fileid).css('height', new_vH);
centerDropblock(fileid, new_vH / 2, new_vW / 2);
loader.hide();
pBox.show();
}
new_img.src = downloadLink;
} else if (videoTypes.indexOf(filetype) > -1 || (audioTypes.indexOf(filetype) > -1)) { // video or audio
videojs("player-" + fileid, {}, function () {
// Player (this) is initialized and ready.
var myPlayer = this;
if (audioTypes.indexOf(filetype) > -1) { //is audio
new_vW = 350;
new_vH = 60;
myPlayer.dimensions(new_vW, new_vH);
centerDropblock(fileid, new_vH / 2, new_vW / 2);
loader.hide();
pBox.show();
} else { //is video
myPlayer.on('loadedmetadata', function () {
var v = document.getElementById('player-' + fileid + '_html5_api');
vW = v.videoWidth;
vH = v.videoHeight;
vR = vW / vH;
if (vR > sR) {
new_vW = parseInt(sW * 0.9);
new_vH = parseInt(new_vW / vR);
} else {
new_vH = parseInt(sH * 0.9);
new_vW = parseInt(new_vH * vR);
}
myPlayer.dimensions(new_vW, new_vH);
centerDropblock(fileid, new_vH / 2, new_vW / 2);
loader.hide();
pBox.show();
});
}
//error handling
myPlayer.on('error', function () { // error event listener
// dispose the old player and its HTML
error = myPlayer.error();
myPlayer.dispose();
pBox.empty();
pBox.prepend('<div class="dropblock">' + error.message + '</div>');
new_vW = 300;
new_vH = 200;
var dropblock = pBox.find('.dropblock');
dropblock.css('width', new_vW).css('height', new_vH);
dropblock.css('margin-top', (-new_vH / 2) + 'px').css('margin-left', (-new_vW / 2) + 'px');
;
loader.hide();
pBox.show();
})
});
} else { //other type => use googler viewer
new_vW = sW * 0.9;
new_vH = sH * 0.9;
var dropblock = pBox.find('.dropblock');
dropblock.css('width', new_vW).css('height', new_vH);
dropblock.css('margin-top', (-new_vH / 2) + 'px').css('margin-left', (-new_vW / 2) + 'px');
;
$('.dropblock iframe').load(function () {
loader.hide();
pBox.show();
})
}
});
});
})();
centerDropblock = function (fileid, margin_top, margin_left) {
//re-position dropblock
var dropblock = $("#player-" + fileid).parent('.dropblock');
dropblock.css('margin-top', (-margin_top) + 'px');
dropblock.css('margin-left', (-margin_left) + 'px');
dropblock.css('height', '');
dropblock.css('width', '');
dropblock.css('top', '');
dropblock.css('left', '');
}
});
jQuery(document).keyup(function (e) {
if (e.keyCode == 27) { // escape key maps to keycode `27`
pBox = jQuery("#wpfd-box-player");
if (pBox.length) {
pBox.hide();
if (pBox.find(".video-js").length) {
var playerId = pBox.find(".video-js").first().attr("id");
myPlayer = videojs(playerId);
myPlayer.dispose();
}
}
}
});

View File

@@ -0,0 +1,51 @@
/**
* WP File Download
*
* @package WP File Download
* @author Joomunited
* @version 1.0
*/
function wpfdTrackDownload() {
if(typeof wpfdparams != "undefined" && wpfdparams.ga_download_tracking == '1') {
jQuery('a.wpfd_downloadlink').click(function(e) {
var href = jQuery(this).attr('href');
var extLink = href.replace(/^https?\:\/\//i, '');
if(typeof _gaq != 'undefined') {
_gaq.push(['_trackEvent', 'WPFD', 'Download', extLink]);
setTimeout(function() { location.href = href; }, 400);
return false;
}
})
//run below code when open preview on new tab
jQuery('a.wpfd_previewlink').click(function(e) {
var href = jQuery(this).attr('href');
var extLink = href.replace(/^https?\:\/\//i, '');
if(typeof _gaq != 'undefined') {
_gaq.push(['_trackEvent', 'WPFD', 'Preview', extLink]);
setTimeout(function() { window.open(href,'_blank');}, 400);
return false;
}
})
}
}
jQuery(document).ready(function($) {
wpfdTrackDownload();
})
function wpfd_remove_loading(el) {
jQuery('.wpfd-loading', el).remove();
}

View File

@@ -0,0 +1,30 @@
/**
* WP File Download
*
* @package WP File Download
* @author Joomunited
* @version 1.0
*/
jQuery(document).ready(function($) {
function preloader() {
$('.wpfd-loading').css('background',"url("+wpfdfrontend.pluginurl + "/app/site/assets/images/balls.gif) no-repeat center center");
}
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent(preloader);
});

View File

@@ -0,0 +1,15 @@
/**
* WP File Download
*
* @package WP File Download
* @author Joomunited
* @version 1.0
*/
bytesToSize = function(bytes) {
var sizes = ['b','kb','mb','gb','tb','pb'];
if (bytes == 0) return 'n/a';
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
};

View File

@@ -0,0 +1,219 @@
// jQuery File Tree Plugin
//
// Version 1.0
//
// Base on the work of Cory S.N. LaViska A Beautiful Site (http://abeautifulsite.net/)
// Dual-licensed under the GNU General Public License and the MIT License
// Icons from famfamfam silk icon set thanks to http://www.famfamfam.com/lab/icons/silk/
//
// Usage : $('#jao').jaofiletree(options);
//
// Author: Damien Barrère
// Website: http://www.crac-design.com
(function( $ ) {
var options = {
'root' : '/',
'script' : 'connectors/jaoconnector.php',
'showroot' : 'root',
'onclick' : function(elem,type,file){},
'oncheck' : function(elem,checked,type,file){},
'usecheckboxes' : true, //can be true files dirs or false
'expandSpeed' : 500,
'collapseSpeed' : 500,
'expandEasing' : null,
'collapseEasing' : null,
'canselect' : true
};
var methods = {
init : function( o ) {
if($(this).length==0){
return;
}
$this = $(this);
$.extend(options,o);
if(options.showroot!=''){
$this.html('<ul class="jaofiletree"><li class="drive directory collapsed selected">'+
'<div class="icon-open-close" ></div>'
+ '<i class="zmdi zmdi-folder"></i><a href="#" data-file="'+options.root+'" data-type="dir">'+options.showroot+'</a></li></ul>');
}
openfolder(options.root);
},
open : function(dir){
openfolder(dir);
},
close : function(dir){
closedir(dir);
},
getchecked : function(){
var list = new Array();
var ik = 0;
$this.find('input:checked + a').each(function(){
list[ik] = {
type : $(this).attr('data-type'),
file : $(this).attr('data-file')
}
ik++;
});
return list;
},
getselected : function(){
var list = new Array();
var ik = 0;
$this.find('li.selected > a').each(function(){
list[ik] = {
type : $(this).attr('data-type'),
file : $(this).attr('data-file')
}
ik++;
});
return list;
}
};
openfolder = function(dir) {
if($this.find('a[data-file="'+dir+'"]').parent().hasClass('expanded')){
return;
}
var ret;
ret = $.ajax({
url : options.script,
data : {dir : dir},
context : $this,
dataType: 'json',
beforeSend : function(){this.find('a[data-file="'+dir+'"]').parent().addClass('wait');}
}).done(function(datas) {
ret = '<ul class="jaofiletree" style="display: none">';
for(ij=0; ij<datas.length; ij++){
classe = 'directory collapsed';
ret += '<li class="'+classe+'">';
if(datas[ij].count_child > 0){
ret += '<div class="icon-open-close" data-id="' + datas[ij].term_id + '" data-parent_id="' + datas[ij].parent + '" data-file="' +datas[ij].term_id + '" ></div>';
}else{
ret += '<div class="icon-open-close" data-id="' + datas[ij].term_id + '" data-parent_id="' + datas[ij].parent + '" data-file="' +datas[ij].term_id + '" ></div>';
}
selectedId = dir;
if(datas[ij].term_id === selectedId.toString()) {
ret += '<i class="zmdi zmdi-folder zmdi-folder-open"></i>';
}else {
ret += '<i class="zmdi zmdi-folder"></i>';
}
ret += '<a href="#" data-file="'+datas[ij].term_id+'" >'+datas[ij].name+'</a>';
ret += '</li>';
}
ret += '</ul>';
this.find('a[data-file="'+dir+'"]').parent().removeClass('wait').removeClass('collapsed').addClass('expanded');
this.find('a[data-file="'+dir+'"]').after(ret);
this.find('a[data-file="'+dir+'"]').next().slideDown(options.expandSpeed,options.expandEasing);
setevents();
}).done(function(){
//Trigger custom event
$this.trigger('afteropen');
$this.trigger('afterupdate');
});
}
closedir = function(dir) {
$this.find('a[data-file="'+dir+'"]').next().slideUp(options.collapseSpeed,options.collapseEasing,function(){$(this).remove();});
$this.find('a[data-file="'+dir+'"]').parent().removeClass('expanded').addClass('collapsed');
setevents();
//Trigger custom event
$this.trigger('afterclose');
$this.trigger('afterupdate');
}
setevents = function(){
$this.find('li a, li .icon-open-close').unbind('click');
//Bind userdefined function on click an element
$this.find('li.directory a').bind('click', function(e) {
$this.find('li').removeClass('selected');
$this.find('i.zmdi').removeClass('zmdi-folder-open').addClass("zmdi-folder");
$(this).parent().addClass('selected');
$(this).parent().find(' > i.zmdi').addClass("zmdi-folder-open");
var $el = $(this);
if($el.data('clicked')){
// Previously clicked, stop actions
e.preventDefault();
e.stopPropagation();
}else{
// Mark to ignore next click
$el.data('clicked', true);
options.onclick(this, $(this).attr('data-file'));
// Unmark after 1 second
window.setTimeout(function(){
$el.removeData('clicked');
}, 1000)
}
return false;
});
//Bind for collapse or expand elements
//$this.find('li.directory.collapsed a').bind('click', function() {methods.open($(this).attr('data-file'));return false;});
// $this.find('li.directory.expanded a').bind('click', function() {methods.close($(this).attr('data-file'));return false;});
$this.find('li.directory.collapsed .icon-open-close').bind('click', function (e) {
e.preventDefault;
var $el = $(this);
if($el.data('clicked')){
// Previously clicked, stop actions
e.preventDefault();
e.stopPropagation();
}else{
// Mark to ignore next click
$el.data('clicked', true);
methods.open($(this).attr('data-file'));
// Unmark after 1 second
window.setTimeout(function(){
$el.removeData('clicked');
}, 1000)
}
});
$this.find('li.directory.expanded .icon-open-close').bind('click', function (e) {
e.preventDefault;
var $el = $(this);
if($el.data('clicked')){
// Previously clicked, stop actions
e.preventDefault();
e.stopPropagation();
}else{
// Mark to ignore next click
$el.data('clicked', true);
methods.close($(this).attr('data-file'));
// Unmark after 1 second
window.setTimeout(function(){
$el.removeData('clicked');
}, 1000)
}
});
}
$.fn.jaofiletree = function( method ) {
// Method calling logic
if ( methods[method] ) {
return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 ));
} else if ( typeof method === 'object' || ! method ) {
return methods.init.apply( this, arguments );
} else {
//error
}
};
})( jQuery );

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,9 @@
function wpfd_frameload() {
jQuery("#wpfd_loader").hide();
jQuery("#wpfdmodalframe").show();
}
jQuery(document).ready(function($){
$('.wpfdlaunch').leanModal({ top : 20, beforeShow: function(){ $("#wpfdmodal").css("height","90%"); $("#wpfdmodalframe").hide(); $("#wpfdmodalframe").attr('src', $("#wpfdmodalframe").attr('src')); $("#wpfd_loader").show(); } });
$('body').append('<div id="wpfdmodal"><img src="images/spinner-2x.gif" width="32" id="wpfd_loader" /><iframe id="wpfdmodalframe" onload="wpfd_frameload()" width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto" src="'+wpfdmodalvars.adminurl+'admin.php?page=wpfd&noheader=1&caninsert=1" /><button id="wpfd-close-modal" onclick="jQuery(\'#lean_overlay\',window.parent.document).fadeOut(300);jQuery(\'#wpfdmodal\',window.parent.document).fadeOut(300);" style="position: absolute; right: -23px;">x</button></div>');
return false;
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long