mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 08:34:29 +00:00
Second commit
This commit is contained in:
Vendored
-7
File diff suppressed because one or more lines are too long
Vendored
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -1,221 +0,0 @@
|
||||
/*
|
||||
Author : Tomaz Dragar
|
||||
Mail : <[email protected]>
|
||||
Homepage : http://www.dragar.net
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.fn.simpleCropper = function() {
|
||||
|
||||
var image_dimension_x = 600;
|
||||
var image_dimension_y = 600;
|
||||
var scaled_width = 0;
|
||||
var scaled_height = 0;
|
||||
var x1 = 0;
|
||||
var y1 = 0;
|
||||
var x2 = 0;
|
||||
var y2 = 0;
|
||||
var current_image = null;
|
||||
var aspX = 1;
|
||||
var aspY = 1;
|
||||
var file_display_area = null;
|
||||
var ias = null;
|
||||
var jcrop_api;
|
||||
var bottom_html = "<input type='file' id='fileInput' name='files[]'/><canvas id='myCanvas' style='display:none;'></canvas><div id='modal'></div><div id='preview'><div class='buttons'><div class='cancel' style='background-image:url(../../skin/images/false-27.png);'></div><div class='ok' style='background-image:url(../../skin/images/true-27.png);'></div></div></div>";
|
||||
$('body').append(bottom_html);
|
||||
|
||||
//add click to element
|
||||
this.click(function() {
|
||||
aspX = $(this).width();
|
||||
aspY = $(this).height();
|
||||
file_display_area = $(this);
|
||||
$('#fileInput').click();
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
//capture selected filename
|
||||
$('#fileInput').change(function(click) {
|
||||
imageUpload($('#preview').get(0));
|
||||
// Reset input value
|
||||
$(this).val("");
|
||||
});
|
||||
|
||||
//ok listener
|
||||
$('.ok').click(function() {
|
||||
preview();
|
||||
$('#preview').delay(100).hide();
|
||||
$('#modal').hide();
|
||||
jcrop_api.destroy();
|
||||
reset();
|
||||
});
|
||||
|
||||
//cancel listener
|
||||
$('.cancel').click(function(event) {
|
||||
$('#preview').delay(100).hide();
|
||||
$('#modal').hide();
|
||||
jcrop_api.destroy();
|
||||
reset();
|
||||
});
|
||||
});
|
||||
|
||||
function reset() {
|
||||
scaled_width = 0;
|
||||
scaled_height = 0;
|
||||
x1 = 0;
|
||||
y1 = 0;
|
||||
x2 = 0;
|
||||
y2 = 0;
|
||||
current_image = null;
|
||||
aspX = 1;
|
||||
aspY = 1;
|
||||
file_display_area = null;
|
||||
}
|
||||
|
||||
function imageUpload(dropbox) {
|
||||
var file = $("#fileInput").get(0).files[0];
|
||||
//var file = document.getElementById('fileInput').files[0];
|
||||
var imageType = /image.*/;
|
||||
|
||||
if (file.type.match(imageType)) {
|
||||
var reader = new FileReader();
|
||||
|
||||
reader.onload = function(e) {
|
||||
// Clear the current image.
|
||||
$('#photo').remove();
|
||||
|
||||
// Create a new image with image crop functionality
|
||||
current_image = new Image();
|
||||
current_image.src = reader.result;
|
||||
current_image.id = "photo";
|
||||
current_image.style['maxWidth'] = image_dimension_x + 'px';
|
||||
current_image.style['maxHeight'] = image_dimension_y + 'px';
|
||||
current_image.onload = function() {
|
||||
// Calculate scaled image dimensions
|
||||
if (current_image.width > image_dimension_x || current_image.height > image_dimension_y) {
|
||||
if (current_image.width > current_image.height) {
|
||||
scaled_width = image_dimension_x;
|
||||
scaled_height = image_dimension_x * current_image.height / current_image.width;
|
||||
}
|
||||
if (current_image.width < current_image.height) {
|
||||
scaled_height = image_dimension_y;
|
||||
scaled_width = image_dimension_y * current_image.width / current_image.height;
|
||||
}
|
||||
if (current_image.width == current_image.height) {
|
||||
scaled_width = image_dimension_x;
|
||||
scaled_height = image_dimension_y;
|
||||
}
|
||||
}
|
||||
else {
|
||||
scaled_width = current_image.width;
|
||||
scaled_height = current_image.height;
|
||||
}
|
||||
|
||||
|
||||
// Position the modal div to the center of the screen
|
||||
$('#modal').css('display', 'block');
|
||||
var window_width = $(window).width() / 2 - scaled_width / 2 + "px";
|
||||
var window_height = $(window).height() / 2 - scaled_height / 2 + "px";
|
||||
|
||||
// Show image in modal view
|
||||
$("#preview").css("top", window_height);
|
||||
$("#preview").css("left", window_width);
|
||||
$('#preview').show(500);
|
||||
|
||||
|
||||
// Calculate selection rect
|
||||
var selection_width = 0;
|
||||
var selection_height = 0;
|
||||
|
||||
var max_x = Math.floor(scaled_height * aspX / aspY);
|
||||
var max_y = Math.floor(scaled_width * aspY / aspX);
|
||||
|
||||
|
||||
if (max_x > scaled_width) {
|
||||
selection_width = scaled_width;
|
||||
selection_height = max_y;
|
||||
}
|
||||
else {
|
||||
selection_width = max_x;
|
||||
selection_height = scaled_height;
|
||||
}
|
||||
|
||||
ias = $(this).Jcrop({
|
||||
onSelect: showCoords,
|
||||
onChange: showCoords,
|
||||
bgColor: '#747474',
|
||||
bgOpacity: .4,
|
||||
aspectRatio: aspX / aspY,
|
||||
setSelect: [0, 0, selection_width, selection_height]
|
||||
}, function() {
|
||||
jcrop_api = this;
|
||||
});
|
||||
}
|
||||
|
||||
// Add image to dropbox element
|
||||
dropbox.appendChild(current_image);
|
||||
}
|
||||
reader.readAsDataURL(file);
|
||||
|
||||
} else {
|
||||
dropbox.innerHTML = "File not supported!";
|
||||
}
|
||||
}
|
||||
|
||||
function showCoords(c) {
|
||||
x1 = c.x;
|
||||
y1 = c.y;
|
||||
x2 = c.x2;
|
||||
y2 = c.y2;
|
||||
}
|
||||
|
||||
function preview() {
|
||||
// Set canvas
|
||||
var canvas = document.getElementById('myCanvas');
|
||||
var context = canvas.getContext('2d');
|
||||
|
||||
// Delete previous image on canvas
|
||||
context.clearRect(0, 0, canvas.width, canvas.height);
|
||||
|
||||
// Set selection width and height
|
||||
var sw = x2 - x1;
|
||||
var sh = y2 - y1;
|
||||
|
||||
|
||||
// Set image original width and height
|
||||
var imgWidth = current_image.naturalWidth;
|
||||
var imgHeight = current_image.naturalHeight;
|
||||
|
||||
// Set selection koeficient
|
||||
var kw = imgWidth / $("#preview").width();
|
||||
var kh = imgHeight / $("#preview").height();
|
||||
|
||||
// Set canvas width and height and draw selection on it
|
||||
canvas.width = aspX;
|
||||
canvas.height = aspY;
|
||||
context.drawImage(current_image, (x1 * kw), (y1 * kh), (sw * kw), (sh * kh), 0, 0, aspX, aspY);
|
||||
|
||||
// Convert canvas image to normal img
|
||||
var dataUrl = canvas.toDataURL();
|
||||
var imageFoo = document.createElement('img');
|
||||
imageFoo.src = dataUrl;
|
||||
|
||||
// Append it to the body element
|
||||
$('#preview').delay(100).hide();
|
||||
$('#modal').hide();
|
||||
file_display_area.html('');
|
||||
file_display_area.append(imageFoo);
|
||||
|
||||
}
|
||||
|
||||
$(window).resize(function() {
|
||||
// Position the modal div to the center of the screen
|
||||
var window_width = $(window).width() / 2 - scaled_width / 2 + "px";
|
||||
var window_height = $(window).height() / 2 - scaled_height / 2 + "px";
|
||||
|
||||
// Show image in modal view
|
||||
$("#preview").css("top", window_height);
|
||||
$("#preview").css("left", window_width);
|
||||
});
|
||||
}
|
||||
}(jQuery));
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* Metadata - jQuery plugin for parsing metadata from elements
|
||||
*
|
||||
* Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* Revision: $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets the type of metadata to use. Metadata is encoded in JSON, and each property
|
||||
* in the JSON will become a property of the element itself.
|
||||
*
|
||||
* There are three supported types of metadata storage:
|
||||
*
|
||||
* attr: Inside an attribute. The name parameter indicates *which* attribute.
|
||||
*
|
||||
* class: Inside the class attribute, wrapped in curly braces: { }
|
||||
*
|
||||
* elem: Inside a child element (e.g. a script tag). The
|
||||
* name parameter indicates *which* element.
|
||||
*
|
||||
* The metadata for an element is loaded the first time the element is accessed via jQuery.
|
||||
*
|
||||
* As a result, you can define the metadata type, use $(expr) to load the metadata into the elements
|
||||
* matched by expr, then redefine the metadata type and run another $(expr) for other elements.
|
||||
*
|
||||
* @name $.metadata.setType
|
||||
*
|
||||
* @example <p id="one" class="some_class {item_id: 1, item_label: 'Label'}">This is a p</p>
|
||||
* @before $.metadata.setType("class")
|
||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||
* @desc Reads metadata from the class attribute
|
||||
*
|
||||
* @example <p id="one" class="some_class" data="{item_id: 1, item_label: 'Label'}">This is a p</p>
|
||||
* @before $.metadata.setType("attr", "data")
|
||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||
* @desc Reads metadata from a "data" attribute
|
||||
*
|
||||
* @example <p id="one" class="some_class"><script>{item_id: 1, item_label: 'Label'}</script>This is a p</p>
|
||||
* @before $.metadata.setType("elem", "script")
|
||||
* @after $("#one").metadata().item_id == 1; $("#one").metadata().item_label == "Label"
|
||||
* @desc Reads metadata from a nested script element
|
||||
*
|
||||
* @param String type The encoding type
|
||||
* @param String name The name of the attribute to be used to get metadata (optional)
|
||||
* @cat Plugins/Metadata
|
||||
* @descr Sets the type of encoding to be used when loading metadata for the first time
|
||||
* @type undefined
|
||||
* @see metadata()
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
|
||||
$.extend({
|
||||
metadata : {
|
||||
defaults : {
|
||||
type: 'class',
|
||||
name: 'metadata',
|
||||
cre: /({.*})/,
|
||||
single: 'metadata'
|
||||
},
|
||||
setType: function( type, name ){
|
||||
this.defaults.type = type;
|
||||
this.defaults.name = name;
|
||||
},
|
||||
get: function( elem, opts ){
|
||||
var settings = $.extend({},this.defaults,opts);
|
||||
// check for empty string in single property
|
||||
if ( !settings.single.length ) settings.single = 'metadata';
|
||||
|
||||
var data = $.data(elem, settings.single);
|
||||
// returned cached data if it already exists
|
||||
if ( data ) return data;
|
||||
|
||||
data = "{}";
|
||||
|
||||
if ( settings.type == "class" ) {
|
||||
var m = settings.cre.exec( elem.className );
|
||||
if ( m )
|
||||
data = m[1];
|
||||
} else if ( settings.type == "elem" ) {
|
||||
if( !elem.getElementsByTagName )
|
||||
return undefined;
|
||||
var e = elem.getElementsByTagName(settings.name);
|
||||
if ( e.length )
|
||||
data = $.trim(e[0].innerHTML);
|
||||
} else if ( elem.getAttribute != undefined ) {
|
||||
var attr = elem.getAttribute( settings.name );
|
||||
if ( attr )
|
||||
data = attr;
|
||||
}
|
||||
|
||||
if ( data.indexOf( '{' ) <0 )
|
||||
data = "{" + data + "}";
|
||||
|
||||
data = eval("(" + data + ")");
|
||||
|
||||
$.data( elem, settings.single, data );
|
||||
return data;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the metadata object for the first member of the jQuery object.
|
||||
*
|
||||
* @name metadata
|
||||
* @descr Returns element's metadata object
|
||||
* @param Object opts An object contianing settings to override the defaults
|
||||
* @type jQuery
|
||||
* @cat Plugins/Metadata
|
||||
*/
|
||||
$.fn.metadata = function( opts ){
|
||||
return $.metadata.get( this[0], opts );
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
@@ -1,121 +0,0 @@
|
||||
|
||||
/*
|
||||
* Superfish v1.4.8 - jQuery menu widget
|
||||
* Copyright (c) 2008 Joel Birch
|
||||
*
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
|
||||
*/
|
||||
|
||||
;(function($){
|
||||
$.fn.superfish = function(op){
|
||||
|
||||
var sf = $.fn.superfish,
|
||||
c = sf.c,
|
||||
$arrow = $(['<span class="',c.arrowClass,'"> »</span>'].join('')),
|
||||
over = function(){
|
||||
var $$ = $(this), menu = getMenu($$);
|
||||
clearTimeout(menu.sfTimer);
|
||||
$$.showSuperfishUl().siblings().hideSuperfishUl();
|
||||
},
|
||||
out = function(){
|
||||
var $$ = $(this), menu = getMenu($$), o = sf.op;
|
||||
clearTimeout(menu.sfTimer);
|
||||
menu.sfTimer=setTimeout(function(){
|
||||
o.retainPath=($.inArray($$[0],o.$path)>-1);
|
||||
$$.hideSuperfishUl();
|
||||
if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
|
||||
},o.delay);
|
||||
},
|
||||
getMenu = function($menu){
|
||||
var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
|
||||
sf.op = sf.o[menu.serial];
|
||||
return menu;
|
||||
},
|
||||
addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
|
||||
|
||||
return this.each(function() {
|
||||
var s = this.serial = sf.o.length;
|
||||
var o = $.extend({},sf.defaults,op);
|
||||
o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
|
||||
$(this).addClass([o.hoverClass,c.bcClass].join(' '))
|
||||
.filter('li:has(ul)').removeClass(o.pathClass);
|
||||
});
|
||||
sf.o[s] = sf.op = o;
|
||||
|
||||
$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
|
||||
if (o.autoArrows) addArrow( $('>a:first-child',this) );
|
||||
})
|
||||
.not('.'+c.bcClass)
|
||||
.hideSuperfishUl();
|
||||
|
||||
var $a = $('a',this);
|
||||
$a.each(function(i){
|
||||
var $li = $a.eq(i).parents('li');
|
||||
$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
|
||||
});
|
||||
o.onInit.call(this);
|
||||
|
||||
}).each(function() {
|
||||
var menuClasses = [c.menuClass];
|
||||
if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
|
||||
$(this).addClass(menuClasses.join(' '));
|
||||
});
|
||||
};
|
||||
|
||||
var sf = $.fn.superfish;
|
||||
sf.o = [];
|
||||
sf.op = {};
|
||||
sf.IE7fix = function(){
|
||||
var o = sf.op;
|
||||
if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
|
||||
this.toggleClass(sf.c.shadowClass+'-off');
|
||||
};
|
||||
sf.c = {
|
||||
bcClass : 'sf-breadcrumb',
|
||||
menuClass : 'sf-js-enabled',
|
||||
anchorClass : 'sf-with-ul',
|
||||
arrowClass : 'sf-sub-indicator',
|
||||
shadowClass : 'sf-shadow'
|
||||
};
|
||||
sf.defaults = {
|
||||
hoverClass : 'sfHover',
|
||||
pathClass : 'overideThisToUse',
|
||||
pathLevels : 1,
|
||||
delay : 800,
|
||||
animation : {opacity:'show'},
|
||||
speed : 'normal',
|
||||
autoArrows : true,
|
||||
dropShadows : true,
|
||||
disableHI : false, // true disables hoverIntent detection
|
||||
onInit : function(){}, // callback functions
|
||||
onBeforeShow: function(){},
|
||||
onShow : function(){},
|
||||
onHide : function(){}
|
||||
};
|
||||
$.fn.extend({
|
||||
hideSuperfishUl : function(){
|
||||
var o = sf.op,
|
||||
not = (o.retainPath===true) ? o.$path : '';
|
||||
o.retainPath = false;
|
||||
var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
|
||||
.find('>ul').hide().css('visibility','hidden');
|
||||
o.onHide.call($ul);
|
||||
return this;
|
||||
},
|
||||
showSuperfishUl : function(){
|
||||
var o = sf.op,
|
||||
sh = sf.c.shadowClass+'-off',
|
||||
$ul = this.addClass(o.hoverClass)
|
||||
.find('>ul:hidden').css('visibility','visible');
|
||||
sf.IE7fix.call($ul);
|
||||
o.onBeforeShow.call($ul);
|
||||
$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user