diff options
author | Sem <sembrestels@riseup.net> | 2013-11-09 16:22:50 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2013-11-09 16:22:50 +0100 |
commit | f448cd91f9ecebea37daf40aada2fa1a20200817 (patch) | |
tree | 4636059da6a1be133a4974e5098b7c1e08944dd5 /mod/lightpics/views/default/js/photos | |
parent | 52335325e5ea8c89c711e1ba40d9ac1657004e61 (diff) | |
parent | 324f39c3a9aa41e9e23bafba38882a2b72f62441 (diff) | |
download | elgg-f448cd91f9ecebea37daf40aada2fa1a20200817.tar.gz elgg-f448cd91f9ecebea37daf40aada2fa1a20200817.tar.bz2 |
Add 'mod/lightpics/' from commit '324f39c3a9aa41e9e23bafba38882a2b72f62441'
git-subtree-dir: mod/lightpics
git-subtree-mainline: 52335325e5ea8c89c711e1ba40d9ac1657004e61
git-subtree-split: 324f39c3a9aa41e9e23bafba38882a2b72f62441
Diffstat (limited to 'mod/lightpics/views/default/js/photos')
-rw-r--r-- | mod/lightpics/views/default/js/photos/tidypics.php | 43 | ||||
-rw-r--r-- | mod/lightpics/views/default/js/photos/upload.php | 63 |
2 files changed, 106 insertions, 0 deletions
diff --git a/mod/lightpics/views/default/js/photos/tidypics.php b/mod/lightpics/views/default/js/photos/tidypics.php new file mode 100644 index 000000000..1ff7b2c40 --- /dev/null +++ b/mod/lightpics/views/default/js/photos/tidypics.php @@ -0,0 +1,43 @@ +<?php +/** + * + */ + +?> + +elgg.provide('elgg.tidypics'); + +elgg.tidypics.init = function() { + + if (elgg.ui.lightbox) { + $('.elgg-lightbox, .elgg-lightbox-photo').colorbox({ + href: function() { + if ((new RegExp("photos/image/[0-9]+", 'i')).test($(this).attr('href'))) { + var guid = (new RegExp("photos/image/[0-9]+", 'i')).exec($(this).attr('href')).toString().substr("photos/image/".length); + return elgg.config.wwwroot + "photos/thumbnail/" + guid + "/large"; + } else { + return $(this).attr('href'); + } + }, + title: function() { + return '<h3 style="display: inline">'+ $(this).find('img').attr('title') +'</h3> - <a href="'+ $(this).attr('href') +'">'+ elgg.echo('comments') +'</a>'; + } + }); + } + + $("#tidypics-sort").sortable({ + opacity: 0.7, + revert: true, + scroll: true + }); + + $('.elgg-form-photos-album-sort').submit(function() { + var tidypics_guids = []; + $("#tidypics-sort li").each(function(index) { + tidypics_guids.push($(this).attr('id')); + }); + $('input[name="guids"]').val(tidypics_guids.toString()); + }); +}; + +elgg.register_hook_handler('init', 'system', elgg.tidypics.init); diff --git a/mod/lightpics/views/default/js/photos/upload.php b/mod/lightpics/views/default/js/photos/upload.php new file mode 100644 index 000000000..e3922c8c8 --- /dev/null +++ b/mod/lightpics/views/default/js/photos/upload.php @@ -0,0 +1,63 @@ +<?php +/** + * + */ + +if ($maxfilesize = (int) elgg_get_plugin_setting('maxfilesize', 'lightpics')) { + $maxfilesize *= 1024 * 1024; +} else { + $maxfilesize = 5 * 1024 * 1024; +} +?> + +elgg.provide('elgg.tidypics.upload'); + +elgg.tidypics.upload.init = function() { + + window.locale = { + "fileupload": { + "error": elgg.echo('tidypics:upload:error'), + "errors": { + "maxFileSize": elgg.echo('tidypics:upload:maxfilesize'), + "minFileSize": elgg.echo('tidypics:upload:minfilesize'), + "acceptFileTypes": elgg.echo('tidypics:upload:acceptfiletypes'), + "maxNumberOfFiles": elgg.echo('tidypics:upload:maxnumberoffiles'), + }, + } + }; + + $.widget('blueimpJUI.fileupload', $.blueimpUI.fileupload, { + _transition: function (node) { + var that = this, + deferred = $.Deferred(); + if (node.hasClass('fade')) { + node.fadeToggle(function () { + deferred.resolveWith(node); + }); + } else { + deferred.resolveWith(node); + } + return deferred; + }, + }); + + // Initialize the jQuery File Upload widget: + $('#fileupload').fileupload(); + + // Settings + $('#fileupload').fileupload('option', { + maxFileSize: <?php echo $maxfilesize; ?>, + acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, + change: function() { + elgg.tidypics.upload.fileinput.hide().appendTo($('#fileupload')); + elgg.tidypics.upload.fileinput = $('#fileupload .elgg-input-file'); + }, + drop: function () { + return false; + } + }); + + elgg.tidypics.upload.fileinput = $('#fileupload .elgg-input-file'); +}; + +elgg.register_hook_handler('init', 'system', elgg.tidypics.upload.init); |