This repository has been archived by the owner on Feb 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
180 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<html> | ||
<head> | ||
<title>KCFinder jQuery Adapter Example</title> | ||
<script src="http://code.jquery.com/jquery-2.0.3.min.js" type="text/javascript"></script> | ||
<script src="jquery.js" type="text/javascript"></script> | ||
<style type="text/css"> | ||
#kcfinder { | ||
width: 700px; | ||
height: 400px; | ||
border: 1px solid #6b6b6b; | ||
border-radius: 5px; | ||
} | ||
#kcfinder iframe { | ||
border-radius: 5px; | ||
} | ||
</style> | ||
<script type="text/javascript"> | ||
$(function() { | ||
$('#kcfinder').kcfinder({ | ||
url: "../browse.php", | ||
theme: "dark", | ||
lang: "bg", | ||
callback: function(file) { | ||
alert('Selected file: "' + file + '"'); | ||
}, | ||
callbackMultiple: function(files) { | ||
alert('Selected files:\n "' + files.join('",\n "') + '"'); | ||
} | ||
}); | ||
}); | ||
</script> | ||
</head> | ||
<body> | ||
<div id="kcfinder"></div> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/*! jQuery adapter for KCFinder | ||
* http://kcfinder.sunhater.com | ||
* Pavel Tzonkov <[email protected]> | ||
*/ | ||
/* BASE USAGE: | ||
* <div id="filemanager" style="width:700px;height:400px"></div> | ||
* <script> | ||
* $('#filemanager').kcfinder(); | ||
* </script> | ||
*/ | ||
|
||
(function($) { | ||
var defaultURL = "browse.php"; // Define here your default URL to KCFinder | ||
|
||
$.fn.kcfinder = function(options) { | ||
|
||
var url, i, | ||
t = $(this).get(0), | ||
|
||
// Default options | ||
o = { | ||
url: defaultURL, | ||
lang: "", | ||
theme: "", | ||
type: "", | ||
dir: "", | ||
callback: false, | ||
callbackMultiple: false | ||
}, | ||
ifr = $('<iframe></iframe>'), | ||
|
||
// GET parameters to parse URL | ||
parse = ['lang', 'theme', 'type', 'dir']; | ||
|
||
$.extend(true, o, options); | ||
|
||
// Parse URL | ||
url = o.url; | ||
url += (url.indexOf('?') === -1) ? '?' : "&"; | ||
for (i in parse) { | ||
i = parse[i]; | ||
if (o[i].length) | ||
url += i + "=" + encodeURIComponent(o[i]) + "&"; | ||
} | ||
url = url.substr(0, url.length - 1); | ||
|
||
// Iframe setup | ||
ifr.css({ | ||
margin: 0, | ||
padding: 0, | ||
width: $(t).innerWidth(), | ||
height: $(t).innerHeight(), | ||
border: "none" | ||
}).attr({ | ||
src: url | ||
}); | ||
|
||
$(t).html(ifr); | ||
|
||
// Callbacks | ||
if ($.isFunction(o.callback) || $.isFunction(o.callbackMultiple)) { | ||
if (!window.KCFinder) | ||
window.KCFinder = {}; | ||
|
||
// Single file callback | ||
if ($.isFunction(o.callback)) | ||
window.KCFinder.callBack = o.callback; | ||
else if (window.KCFinder && window.KCFinder.callback) | ||
delete window.KCFinder.callback; | ||
|
||
// Multiple files callback | ||
if ($.isFunction(o.callbackMultiple)) | ||
window.KCFinder.callBackMultiple = o.callbackMultiple; | ||
else if (window.KCFinder && window.KCFinder.callbackMultiple) | ||
delete window.KCFinder.callbackMultiple; | ||
|
||
// No callbacks | ||
} else if (window.KCFinder) | ||
delete window.KCFinder; | ||
} | ||
|
||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters