diff options
Diffstat (limited to 'views/default/js/photos')
| -rw-r--r-- | views/default/js/photos/tagging.php | 159 | ||||
| -rw-r--r-- | views/default/js/photos/uploading.php | 94 | 
2 files changed, 0 insertions, 253 deletions
diff --git a/views/default/js/photos/tagging.php b/views/default/js/photos/tagging.php deleted file mode 100644 index f444aa44c..000000000 --- a/views/default/js/photos/tagging.php +++ /dev/null @@ -1,159 +0,0 @@ -<?php -/** - * Photo tagging JavaScript - * - * @author Cash Costello - * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2 - */ - -?> -//<script> -elgg.provide('elgg.tidypics.tagging'); - -elgg.tidypics.tagging.init = function() { -	elgg.tidypics.tagging.active = false; -	$('[rel=photo-tagging]').click(elgg.tidypics.tagging.start); - -	$('#tidypics-tagging-quit').click(elgg.tidypics.tagging.stop); - -	$('.tidypics-tag').each(elgg.tidypics.tagging.position); - -	elgg.tidypics.tagging.tag_hover = false; -	elgg.tidypics.tagging.toggleTagHover(); -}; - -/** - * Start a tagging session - */ -elgg.tidypics.tagging.start = function(event) { - -	if (elgg.tidypics.tagging.active) { -		elgg.tidypics.tagging.stop(event); -		return; -	} - -	$('.tidypics-photo').imgAreaSelect({ -		disable      : false, -		hide         : false, -		classPrefix  : 'tidypics-tagging', -		onSelectEnd  : elgg.tidypics.tagging.startSelect, -		onSelectStart: function() { -			$('#tidypics-tagging-select').hide(); -		} -	}); - -	elgg.tidypics.tagging.toggleTagHover(); - -	$('.tidypics-photo').css({"cursor" : "crosshair"}); - -	$('#tidypics-tagging-help').toggle(); - -	elgg.tidypics.tagging.active = true; - -	event.preventDefault(); -}; - -/** - * Stop tagging - * - * A tagging session could be completed or the user could have quit. - */ -elgg.tidypics.tagging.stop = function(event) { -	$('#tidypics-tagging-help').toggle(); -	$('#tidypics-tagging-select').hide(); - -	$('.tidypics-photo').imgAreaSelect({hide: true, disable: true}); -	$('.tidypics-photo').css({"cursor" : "pointer"}); - -	elgg.tidypics.tagging.active = false; -	elgg.tidypics.tagging.toggleTagHover(); - -	event.preventDefault(); -}; - -/** - * Start the selection stage of tagging - */ -elgg.tidypics.tagging.startSelect = function(img, selection) { - -	var coords  = '"x1":"' + selection.x1 + '",'; -	coords += '"y1":"' + selection.y1 + '",'; -	coords += '"width":"' + selection.width + '",'; -	coords += '"height":"' + selection.height + '"'; -	$("input[name=coordinates]").val(coords); - -	$('#tidypics-tagging-select').show() -		.css({ -			'top' : selection.y2 + 10, -			'left' : selection.x2 -		}) -		.find('input[type=text]').focus(); - -}; - -/** - * Position the tags over the image - */ -elgg.tidypics.tagging.position = function() { -	var tag_left = parseInt($(this).data('x1')); -	var tag_top = parseInt($(this).data('y1')); -	var tag_width = parseInt($(this).data('width')); -	var tag_height = parseInt($(this).data('height')); - -	// add image offset -	var image_pos = $('.tidypics-photo').position(); -	tag_left += image_pos.left; -	tag_top += image_pos.top; - -	$(this).parent().css({ -		left: tag_left + 'px', -		top: tag_top + 'px' /* -		width: tag_width + 'px', -		height: tag_height + 'px' */ -	}); - -	$(this).css({ -		width: tag_width + 'px', -		height: tag_height + 'px' -	}); -}; - -/** - * Toggle whether tags are shown on hover over the image - */ -elgg.tidypics.tagging.toggleTagHover = function() { -	if (elgg.tidypics.tagging.tag_hover == false) { -		$('.tidypics-photo').hover( -			function() { -				$('.tidypics-tag-wrapper').show(); -			}, -			function(event) { -				// this check handles the tags appearing over the image -				var mouseX = event.pageX; -				var mouseY = event.pageY; -				var offset = $('.tidypics-photo').offset(); -				var width = $('.tidypics-photo').outerWidth() - 1; -				var height = $('.tidypics-photo').outerHeight() - 1; - -				mouseX -= offset.left; -				mouseY -= offset.top; - -				if (mouseX < 0 || mouseX > width || mouseY < 0 || mouseY > height) { -					$('.tidypics-tag-wrapper').hide(); -				} -			} -		); -	} else { -		$('.tidypics-photo').hover( -			function() { -				$('.tidypics-tag-wrapper').hide(); -			}, -			function() { -				$('.tidypics-tag-wrapper').hide(); -			} -		); -	} -	elgg.tidypics.tagging.tag_hover = !elgg.tidypics.tagging.tag_hover; -}; - -elgg.register_hook_handler('init', 'system', elgg.tidypics.tagging.init); diff --git a/views/default/js/photos/uploading.php b/views/default/js/photos/uploading.php deleted file mode 100644 index 465f937ab..000000000 --- a/views/default/js/photos/uploading.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -/** - * AJAX uploading - */ -?> - -//<script> -elgg.provide('elgg.tidypics.uploading'); - -elgg.tidypics.uploading.init = function() { - -	var fields = ['Elgg', 'user_guid', 'album_guid', 'batch', 'tidypics_token']; -	var data = elgg.security.token; - -	$(fields).each(function(i, name) { -		var value = $('input[name=' + name + ']').val(); -		if (value) { -			data[name] = value; -		} -	}); - -	$("#uploadify").uploadify({ -		'uploader'     : elgg.config.wwwroot + 'mod/tidypics/vendors/uploadify/uploadify.swf', -		'script'       : elgg.config.wwwroot + 'action/photos/image/ajax_upload', -		'cancelImg'    : elgg.config.wwwroot + 'mod/tidypics/vendors/uploadify/cancel.png', -		'fileDataName' : 'Image', -		'multi'        : true, -		'auto'         : false, -		'wmode'        : 'transparent', -		'buttonImg'    : " ", -		'height'       : $('#tidypics-choose-button').height(), -		'width'        : $('#tidypics-choose-button').width(), -		'scriptData'   : data, -		'onEmbedFlash' : function(event) { -			// @todo This is supposed to mimick hovering over the link. -			// hover events aren't firing for the object. -			$("#" + event.id).hover( -				function(){ -					$("#tidypics-choose-button").addClass('tidypics-choose-button-hover'); -				}, -				function(){ -					$("#tidypics-choose-button").removeClass('tidypics-choose-button-hover'); -				} -			); -		}, -		'onSelectOnce'  : function() { -			$("#tidypics-upload-button").removeClass('tidypics-disable'); -		}, -		'onAllComplete' : function() { -			// @todo they can keep adding pics if they want. no need to disable this. -			$("#tidypics-choose-button").addClass('tidypics-disable'); -			$("#tidypics-upload-button").addClass('tidypics-disable').die(); -			$("#tidypics-describe-button").removeClass('tidypics-disable'); - -			elgg.action('photos/image/ajax_upload_complete', { -				data: { -					album_guid: data.album_guid, -					batch: data.batch -				}, -				success: function(json) { -					var url = elgg.normalize_url('photos/edit/' + json.batch_guid) -					$('#tidypics-describe-button').attr('href', url); -				} -			}); -		}, -		'onComplete'    : function(event, queueID, fileObj, response) { -			// check for errors here -			if (response != 'success') { -				$("#uploadify" + queueID + " .percentage").text(" - " + response); -				$("#uploadify" + queueID).addClass('uploadifyError'); -			} -			$("#uploadify" + queueID + " > .cancel").remove(); -			return false; -		}, -		'onCancel'      : function(event, queueID, fileObj, data) { -			if (data.fileCount == 0) { -				$("#tidypics-upload-button").addClass('tidypics-disable'); -			} -		}, -		'onError' : function (event, ID, fileObj, errorObj) { -			// @todo do something useful with the limited information in the errorObj. -		} - -	}); - -	// bind to upload button -	$('#tidypics-upload-button').live('click', function(e) { -		var $uploadify = $('#uploadify'); -		$uploadify.uploadifyUpload(); -		e.preventDefault(); -	}); -} - -elgg.register_hook_handler('init', 'system', elgg.tidypics.uploading.init);
\ No newline at end of file  | 
