full working gem for gallery including frontend and backend
This commit is contained in:
1 parent
3b7e9ac0b3
commit
db5294c6ff
54 files changed
+6679
-11
No files matched your search
@@ -1,2 +0,0 @@
|
||||
// Place all the behaviors and hooks related to the matching controller here.
|
||||
// All this logic will automatically be available in application.js.
|
||||
Executable
+1551
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,267 @@
|
||||
!function ($) {
|
||||
$.fn.checkListLength = function (param){
|
||||
_defaultSettings = {
|
||||
onlyOne: null,
|
||||
};
|
||||
_set = $.extend(_defaultSettings, param);
|
||||
$this = this;
|
||||
$li = this.children('li');
|
||||
$dropzone = $('#dropzone');
|
||||
if(($li.length - _set.onlyOne) == 0) {
|
||||
$('#dropzone').fadeIn(300);
|
||||
} else {
|
||||
$('#dropzone').fadeOut(300);
|
||||
};
|
||||
$('#file-list').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true });
|
||||
}
|
||||
}(window.jQuery);
|
||||
|
||||
$(function () {
|
||||
'use strict';
|
||||
// Initialize the jQuery File Upload widget:
|
||||
if($('#fileupload').length){
|
||||
$('#fileupload').fileupload({
|
||||
maxFileSize: 5000000,
|
||||
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
|
||||
dropZone: $('#dropzone'),
|
||||
headers:{
|
||||
'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content")
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$(function() {
|
||||
var $container = $('.gallery'),
|
||||
$containerData = $container.data();
|
||||
$container.imagesLoaded(function(){
|
||||
var $albumname = $('.albumname'),
|
||||
$img = $('.rgalbum img');
|
||||
$('.rgalbum > a').rsImg();
|
||||
if($containerData.galleryId == 'gallery') {
|
||||
$container.masonry({
|
||||
itemSelector : '.rgalbum',
|
||||
isAnimated: true,
|
||||
});
|
||||
$albumname.each(function(i) {
|
||||
var $albumblock = $(this).closest('a').height(),
|
||||
$H = $(this).outerHeight(true);
|
||||
if($H > $albumblock) {
|
||||
$(this).css({
|
||||
'bottom': "auto",
|
||||
'top': 0,
|
||||
});
|
||||
$(this).hover(function() {
|
||||
$(this).stop(true, true).delay(500).animate({
|
||||
'top': '-='+($H-$albumblock),
|
||||
},($H-$albumblock)*10)
|
||||
},function() {
|
||||
$(this).stop(true, true);
|
||||
$(this).css({
|
||||
'bottom': "auto",
|
||||
'top': 0,
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
$('#orbit_gallery').delegate('.icons-tag', clickEvent, function(){
|
||||
$(this).parents('.gallery_info').nextAll('.albumtag').slideToggle(300, function() {
|
||||
$container.masonry({
|
||||
itemSelector : '.rgalbum',
|
||||
isAnimated: true,
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
|
||||
var bindEvent = function(instance,elem){
|
||||
var $e = elem,
|
||||
image_id = $e.closest(".rgalbum").data("image-id");
|
||||
obj = photosData.galleries.filter(function(a) {
|
||||
return a.id == image_id;
|
||||
})[0];
|
||||
switch($e.attr("for")){
|
||||
case "description":
|
||||
if(obj.description){
|
||||
instance.find("textarea").each(function(){
|
||||
if(obj.description[$(this).attr("for")])
|
||||
$(this).val(obj.description[$(this).attr("for")]);
|
||||
})
|
||||
|
||||
}
|
||||
instance.find("input[type=hidden]").val(image_id);
|
||||
instance.find("form").bind("ajax:success",function(evt, data, status){
|
||||
$.pageslide.close();
|
||||
photosData = data;
|
||||
})
|
||||
break;
|
||||
case "tags":
|
||||
instance.find('.tags-groups').cardCheck({
|
||||
item: '.card'
|
||||
});
|
||||
for(i = 0; i < obj.tags.length; i++){
|
||||
instance.find("input[value="+obj.tags[i]+"]").parent().addClass('active');
|
||||
instance.find("input[value="+obj.tags[i]+"]").prop("checked","checked");
|
||||
}
|
||||
instance.find("form").submit(function(event) {
|
||||
var checkboxes = $(this).find("input[type=checkbox]:checked"),
|
||||
tag_ids = [],
|
||||
image_ids =[image_id];
|
||||
|
||||
checkboxes.each(function(){
|
||||
tag_ids.push($(this).val());
|
||||
})
|
||||
|
||||
$.post("/admin/galleries/image_tagging",{"image_ids":image_ids,"tag_ids":tag_ids},function(json){
|
||||
$.pageslide.close();
|
||||
photosData = json;
|
||||
})
|
||||
return false;
|
||||
});
|
||||
break;
|
||||
case "batch":
|
||||
instance.find('.tags-groups').cardCheck({
|
||||
item: '.card'
|
||||
});
|
||||
instance.find("form").submit(function(event) {
|
||||
var checkboxes = $(this).find("input[type=checkbox]:checked"),
|
||||
tag_ids = [],
|
||||
image_ids =[],
|
||||
images = $("#imgholder .rgalbum.active");
|
||||
checkboxes.each(function(){
|
||||
tag_ids.push($(this).val());
|
||||
})
|
||||
images.each(function(){
|
||||
image_ids.push($(this).data("image-id"));
|
||||
})
|
||||
$.post("/admin/galleries/image_tagging",{"image_ids":image_ids,"tag_ids":tag_ids},function(json){
|
||||
$.pageslide.close();
|
||||
photosData = json;
|
||||
})
|
||||
return false;
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var photosData = null;
|
||||
if($("#imgholder").length){
|
||||
$.getJSON(window.location.pathname, function(json, textStatus) {
|
||||
photosData = json;
|
||||
$('.open').pageslide({
|
||||
loadComplete: function(instance,elem) {
|
||||
bindEvent(instance,elem);
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
$("#imgholder").on(clickEvent, '.photo_cover', function(event) {
|
||||
var image_id = $(this).closest(".rgalbum").data("image-id"),
|
||||
album_id = $("#imgholder").data("gallery-id"),
|
||||
set_cover = true;
|
||||
if($(this).children().hasClass("icons-star-2")){
|
||||
$(".icons-star").removeClass("icons-star").addClass('icons-star-2');
|
||||
$(this).children().removeClass("icons-star-2").addClass("icons-star");
|
||||
}else{
|
||||
$(this).children().removeClass("icons-star").addClass("icons-star-2");
|
||||
set_cover = false;
|
||||
}
|
||||
$.post("/admin/galleries/set_cover",{"album_id":album_id,"image_id":image_id,"set_cover":set_cover});
|
||||
|
||||
});
|
||||
|
||||
$("#delete_selected_photos_btn").click(function(){
|
||||
var photos_to_delete = [],
|
||||
delete_cover = false,
|
||||
$photos = $(".rgalbum.active"),
|
||||
album_id = $("#imgholder").data("gallery-id");
|
||||
$('.modal-body .spinning').fadeIn('fast');
|
||||
$('.modal-body .text-warning').hide(0);
|
||||
$photos.each(function(){
|
||||
photos_to_delete.push($(this).data('image-id'));
|
||||
if ($(this).find(".icons-star").length) {
|
||||
delete_cover = true;
|
||||
};
|
||||
});
|
||||
$.ajax({
|
||||
url : "/admin/galleries/delete_photos",
|
||||
type : "POST",
|
||||
data : {"images":photos_to_delete,"delete_cover":delete_cover,"album_id":album_id},
|
||||
success : function(){
|
||||
$photos.slideUp(300,function() {
|
||||
$(this).remove();
|
||||
});
|
||||
$('#dialog').modal('hide');
|
||||
$('.modal-body .spinning').hide();
|
||||
$('.modal-body .text-warning').show();
|
||||
$('.deletephoto, .deselect, .addtags').addClass('hide')
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$('#imgholder').on(clickEvent, '.checkbox', function() {
|
||||
$(this).prop('checked') ? $(this).closest('.rgalbum').addClass('active') : $(this).closest('.rgalbum').removeClass('active');
|
||||
var checkLength = $("#imgholder .rgalbum.active");
|
||||
checkLength.length ? $('.deletephoto, .deselect, .addtags').removeClass('hide') : $('.deletephoto, .deselect, .addtags').addClass('hide');
|
||||
});
|
||||
$('.deselect').on(clickEvent, function(event) {
|
||||
$('.rgalbum').removeClass('active');
|
||||
$('.checkbox').prop('checked', false)
|
||||
$('.deletephoto, .deselect, .addtags').addClass('hide')
|
||||
event.preventDefault();
|
||||
});
|
||||
$('.phtot-action').delegate('li', clickEvent, function(event) {
|
||||
$('.checkbox').prop('checked', false)
|
||||
$('.rgalbum').removeClass('active');
|
||||
$('.deletephoto, .deselect, .addtags').removeClass('hide')
|
||||
});
|
||||
|
||||
//
|
||||
$('.add-imgs').on({
|
||||
click: function() {
|
||||
$('#fileupload').slideToggle(300, function() {
|
||||
if(!$(this).is(':hidden')) {
|
||||
$('.add-imgs').html('<i class="icons-cross-2"></i> Close panel');
|
||||
$('.rgbody').stop(true, false).animate({'padding-bottom': 280}, 300);
|
||||
} else {
|
||||
$('.add-imgs').html('<i class="icons-plus"></i> Add Image');
|
||||
$('.files').empty()
|
||||
$('#file-list').checkListLength();
|
||||
$('.rgbody').stop(true, false).animate({'padding-bottom': 0}, 300);
|
||||
fetchNewImages();
|
||||
};
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
var fetchNewImages = function(){
|
||||
var lastid = ( $("li.rgalbum:last").length ? $("li.rgalbum:last").data("image-id") : null),
|
||||
albumid = $("#fileupload_aid").val();
|
||||
|
||||
$.getJSON(window.location.pathname, function(json, textStatus) {
|
||||
photosData = json;
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url : "/admin/new_images",
|
||||
data : {"last_image_id" : lastid, "album_id" : albumid},
|
||||
success : function(data){
|
||||
var $e = $(data);
|
||||
$imgs = $e.find("img");
|
||||
$("#imgholder").append($e);
|
||||
$os = $e.find("a.open");
|
||||
$os.pageslide({
|
||||
loadComplete: function(instance,elem) {
|
||||
bindEvent(instance,elem);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,278 @@
|
||||
<%# encoding: utf-8 %>
|
||||
$.extend($.expr[':'], {
|
||||
'containsi': function (elem, i, match, array) {
|
||||
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||
}
|
||||
});
|
||||
var galleryAPI = function(){
|
||||
g = this;
|
||||
this.urlVars = rcom.getUrlVars();
|
||||
this.albumArea = $("#orbit_gallery");
|
||||
this.loadArea = null;
|
||||
this.tagList = $("ul#gallery_tag_list");
|
||||
this.loading = $("#loading");
|
||||
|
||||
this.loadTheater = function(id){
|
||||
|
||||
g.loadstart();
|
||||
var imageArray;
|
||||
var imagecount = 0;
|
||||
var picHeight = 0;
|
||||
var bindHandlers = function(){
|
||||
var $slidelist = $('.slidelist'),
|
||||
$rslide = $('.rslide'),
|
||||
$rslidenav = $('.rslidenav'),
|
||||
$img = $("#main_pic img"),
|
||||
wHeight = $(window).height();
|
||||
|
||||
$("#main_pic").height(picHeight);
|
||||
$img.height("100%");
|
||||
|
||||
$('.bt-tag').click(function(){
|
||||
if(!$(this).hasClass("active"))
|
||||
updatePhotoTag();
|
||||
$(this).toggleClass("active");
|
||||
var $tag_panel = $('#tag_panel'),
|
||||
tag_panel_position = 0;
|
||||
|
||||
if( $tag_panel.css('right') == '0px' ){
|
||||
tag_panel_position = -200;
|
||||
}
|
||||
$tag_panel.animate({'right':tag_panel_position}, 300);
|
||||
|
||||
g.albumArea
|
||||
.delay(200)
|
||||
.animate({'margin-right':tag_panel_position+200},300);
|
||||
return false;
|
||||
});
|
||||
var updatePhotoTag = function(){
|
||||
var tags = imageArray[imagecount].tag_ids;
|
||||
if(tags.length > 0 && g.tagList.find("li").length == 0){
|
||||
var tagnames = imageArray[imagecount].tag_names;
|
||||
g.tagList.empty();
|
||||
for(i in tagnames){
|
||||
$li = $("<li><label>"+tagnames[i]+"</label><span style='display:none;'>"+tagnames[i]+"</span></li>");
|
||||
g.tagList.append($li);
|
||||
}
|
||||
}else if(tags.length > 0 && g.tagList.find("li").length > 0) {
|
||||
g.tagList.find("input").attr("checked",false);
|
||||
for(tag in tags){
|
||||
g.tagList.find("li[data-content="+tags[tag]+"] input").attr("checked",true);
|
||||
}
|
||||
}else if(tags.length == 0){
|
||||
if(g.tagList.find("input").length == 0)
|
||||
g.tagList.empty();
|
||||
else
|
||||
g.tagList.find("input").attr("checked",false);
|
||||
}
|
||||
}
|
||||
g.albumArea.find("#tag_search_box").keyup(function(e){
|
||||
sval = $(this).val();
|
||||
if(sval == "<%= I18n.t('gallery.search_tags') %>")
|
||||
sval = "";
|
||||
sval = sval.replace(/(^\s*)|(\s*$)/g,'');
|
||||
if(sval){
|
||||
var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range
|
||||
var re2 = new RegExp("^[\uE7C7-\uE7F3]*$");
|
||||
if ((re1.test(sval) && (re2.test(sval)))){
|
||||
$("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp();
|
||||
}else{
|
||||
$("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp();
|
||||
}
|
||||
|
||||
}else{
|
||||
$("#gallery_tag_list li").slideDown();
|
||||
}
|
||||
})
|
||||
g.albumArea.find("#tag_panel .bt-save").click(function(){
|
||||
g.saveTags(imageArray[imagecount]._id,"pic",function(tagids){
|
||||
imageArray[imagecount].tag_ids = tagids;
|
||||
})
|
||||
})
|
||||
$(".slidectrl a.togglelist").click(function(){
|
||||
var rslide_h = $rslide.outerHeight();
|
||||
if ( $slidelist.height() < 1 ){
|
||||
$slidelist.stop().animate({'height':rslide_h - 30}, 300);
|
||||
$slidelist.find("ul").show();
|
||||
} else {
|
||||
$slidelist.stop().animate({'height':'0px'}, 300);
|
||||
$slidelist.find("ul").hide();
|
||||
}
|
||||
})
|
||||
$(".slidectrl .togglescreen").click(function(){
|
||||
toggleFullscreen();
|
||||
})
|
||||
$(".slidectrl .browserfullscreen").click(function(){
|
||||
browserFullScreen();
|
||||
})
|
||||
$slidelist.find(".list_element").click(function(){
|
||||
imagecount = parseInt($(this).parent().attr("for"));
|
||||
changeImage($(this));
|
||||
})
|
||||
$rslidenav.find(".navN").click(function(){
|
||||
nextpic($(this));
|
||||
})
|
||||
$rslidenav.find("a.navP").click(function(){
|
||||
prevpic($(this));
|
||||
})
|
||||
$("#nextpic").click(function(){
|
||||
nextpic($(this));
|
||||
})
|
||||
|
||||
$(document).keydown(function(e){
|
||||
if (e.keyCode == 37){
|
||||
prevpic($rslidenav.find(".navP"));
|
||||
return false;
|
||||
}
|
||||
if(e.keyCode == 39){
|
||||
nextpic($rslidenav.find(".navN"));
|
||||
return false;
|
||||
}
|
||||
if(e.keyCode == 27){
|
||||
toggleFullscreen();
|
||||
$rslide.removeClass('browserFullScreen');
|
||||
return false;
|
||||
}
|
||||
if(e.keyCode == 70 || e.keyCode == 102){
|
||||
if($rslide.hasClass("fullscreen"))
|
||||
browserFullScreen();
|
||||
}
|
||||
});
|
||||
var browserFullScreen = function(){
|
||||
var el = document.documentElement,
|
||||
rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen;
|
||||
rfs.call(el);
|
||||
}
|
||||
$(window).resize(function(){
|
||||
if(window.innerWidth == screen.width && window.innerHeight == screen.height) {
|
||||
$rslide.addClass('browserFullScreen');
|
||||
} else {
|
||||
$rslide.removeClass('browserFullScreen');
|
||||
}
|
||||
})
|
||||
var nextpic = function(dom){
|
||||
if(imagecount == imageArray.length - 1)
|
||||
imagecount = 0;
|
||||
else
|
||||
imagecount++;
|
||||
changeImage(dom);
|
||||
}
|
||||
var prevpic = function(dom){
|
||||
if(imagecount == 0)
|
||||
imagecount = imageArray.length - 1
|
||||
else
|
||||
imagecount--;
|
||||
changeImage(dom);
|
||||
}
|
||||
var toggleFullscreen = function(){
|
||||
if($rslide.hasClass("fullscreen")){
|
||||
$rslide.css("position","relative");
|
||||
$rslide.removeClass("fullscreen");
|
||||
$(".slidectrl .browserfullscreen").hide();
|
||||
$img.css({"padding":""})
|
||||
$("#main_pic").height(picHeight );
|
||||
}else{
|
||||
$("#main_pic").height(wHeight);
|
||||
// $img.height("100%");
|
||||
$rslide.css("position","");
|
||||
$rslide.addClass("fullscreen");
|
||||
$img.css({"padding":($rslide.height()-$img.height())/2})
|
||||
$(".slidectrl .browserfullscreen").show();
|
||||
}
|
||||
}
|
||||
var changeImage = function(dom){
|
||||
var pageurl = dom.attr('href');
|
||||
|
||||
$img.fadeOut(200,function(){
|
||||
g.loadstart();
|
||||
$img.attr("src","");
|
||||
$img.attr({"src":dom.attr("data-content"),"height":picHeight+"px"}).load(function(){
|
||||
$img.fadeIn(200);
|
||||
g.loadcomplete();
|
||||
});
|
||||
|
||||
|
||||
if($rslide.hasClass("fullscreen")){
|
||||
$img.css({"padding":($rslide.height()-$img.height())/2})
|
||||
}
|
||||
$slidelist.stop().animate({'height':'0px'}, 300);
|
||||
$slidelist.find("ul").hide();
|
||||
if(rcom.getInternetExplorerVersion() == -1){
|
||||
if(pageurl!=window.location){
|
||||
window.history.pushState({path:pageurl},'',pageurl);
|
||||
}
|
||||
}else{
|
||||
window.location.hash = pageurl;
|
||||
}
|
||||
// $(".slideinfo b.info").text(imageArray[imagecount].title);
|
||||
if($('.bt-tag').hasClass("active"))
|
||||
updatePhotoTag();
|
||||
if(imageArray[imagecount].description)
|
||||
$(".slideinfo .info").text(imageArray[imagecount].description);
|
||||
else
|
||||
$(".slideinfo .info").text("");
|
||||
if(imageArray.length > 1)
|
||||
updateNavigation();
|
||||
})
|
||||
|
||||
}
|
||||
var updateNavigation = function(){
|
||||
var next, prev;
|
||||
if(imagecount == 0){
|
||||
next = 1;
|
||||
prev = imageArray.length - 1;
|
||||
}else if(imagecount == imageArray.length - 1){
|
||||
next = 0
|
||||
prev = imageArray.length - 2;
|
||||
}else{
|
||||
next = imagecount + 1;
|
||||
prev = imagecount - 1;
|
||||
}
|
||||
$(".navN").attr({"href":imageArray[next]._id,"data-content":imageArray[next].file.theater.url});
|
||||
$(".navP").attr({"href":imageArray[prev]._id,"data-content":imageArray[prev].file.theater.url});
|
||||
};
|
||||
if(imageArray.length > 1)
|
||||
updateNavigation();
|
||||
}
|
||||
|
||||
var preparestage = function(albumid){
|
||||
$.getJSON("../galleries/"+albumid+"/imgs",function(album){
|
||||
imageArray = eval(album.images);
|
||||
$.each(album.images,function(i,image){
|
||||
if(image._id == id)
|
||||
imagecount = i;
|
||||
})
|
||||
bindHandlers();
|
||||
})
|
||||
}
|
||||
|
||||
if(rcom.getInternetExplorerVersion()!=-1){
|
||||
var photo_id = window.location.hash.replace("#","");
|
||||
if(photo_id){
|
||||
var url = window.location.href;
|
||||
var params = url.split("/");
|
||||
// params[params.length-1] = photo_id;
|
||||
url = url.replace(params[params.length-1],photo_id);
|
||||
|
||||
window.location.href = url;
|
||||
}
|
||||
}
|
||||
|
||||
var albumid = $("#main_pic").attr("data-content");
|
||||
g.albumArea.find(".bt-back").attr("href","../galleries/"+albumid);
|
||||
g.albumArea.find(".bt-edit").attr("href","../albums/"+albumid+"/edit");
|
||||
g.albumArea.css("margin-bottom","0");
|
||||
picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight());
|
||||
preparestage(albumid);
|
||||
|
||||
}
|
||||
this.loadcomplete = function(){
|
||||
g.loading.hide();
|
||||
}
|
||||
this.loadstart = function(){
|
||||
g.loading.show();
|
||||
}
|
||||
|
||||
}
|
||||
galleryAPI.prototype.locale = "<%= I18n.locale %>";
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
<%# encoding: utf-8 %>
|
||||
$.extend($.expr[':'], {
|
||||
'containsi': function (elem, i, match, array) {
|
||||
return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
|
||||
}
|
||||
});
|
||||
var galleryAPI = function(){
|
||||
g = this;
|
||||
this.urlVars = rcom.getUrlVars();
|
||||
this.albumArea = $("#orbit_gallery");
|
||||
this.loadArea = "theater";
|
||||
this.tagList = $(".taglist ul");
|
||||
this.loading = $("#loading");
|
||||
// this.authenticated = false;
|
||||
this.initialize = function(callbackFn){
|
||||
if(g.loadArea == "theater"){
|
||||
if(rcom.getInternetExplorerVersion()!=-1){
|
||||
var photo_id = window.location.hash.replace("#","");
|
||||
if(photo_id){
|
||||
var params = rcom.getUrlVars();
|
||||
var url = window.location.href.split("?")[0];
|
||||
params["image_id"] = photo_id;
|
||||
for(i=0;i<params.length;i++){
|
||||
if(i == 0)
|
||||
url+="?"+params[i]+"="+params[params[i]];
|
||||
else
|
||||
url+="&"+params[i]+"="+params[params[i]];
|
||||
|
||||
}
|
||||
window.location.href = url;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.loadTheater = function(albumid,id){
|
||||
var imageArray;
|
||||
var imagecount = 0;
|
||||
// var picHeight = 0;
|
||||
g.loadstart();
|
||||
var bindHandlers = function(){
|
||||
var $slidelist = $('.slidelist'),
|
||||
$rslide = $('.rslide'),
|
||||
$rslidenav = $('.rslidenav'),
|
||||
$img = $("#main_pic img"),
|
||||
wHeight = $(window).height();
|
||||
|
||||
$("#main_pic").height("auto");
|
||||
$img.css("height","auto");
|
||||
|
||||
var updatePhotoTag = function(){
|
||||
var tags = imageArray[imagecount].tags;
|
||||
g.tagList.empty();
|
||||
for(tag in tags){
|
||||
g.tagList.append("<li>"+tags[tag].name+"</li>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
$(".slidectrl a.togglelist").click(function(){
|
||||
var rslide_h = $rslide.outerHeight();
|
||||
if ( $slidelist.height() < 1 ){
|
||||
$slidelist.stop().animate({'height':rslide_h - 30}, 300);
|
||||
$slidelist.find("ul").show();
|
||||
} else {
|
||||
$slidelist.stop().animate({'height':'0px'}, 300);
|
||||
$slidelist.find("ul").hide();
|
||||
}
|
||||
})
|
||||
$(".slidectrl .togglescreen").click(function(){
|
||||
toggleFullscreen();
|
||||
})
|
||||
$(".slidectrl .browserfullscreen").click(function(){
|
||||
browserFullScreen();
|
||||
})
|
||||
$slidelist.find(".list_element").click(function(){
|
||||
imagecount = parseInt($(this).parent().attr("for"));
|
||||
changeImage($(this));
|
||||
})
|
||||
$rslidenav.find(".navN").click(function(){
|
||||
nextpic($(this));
|
||||
})
|
||||
$rslidenav.find("a.navP").click(function(){
|
||||
prevpic($(this));
|
||||
})
|
||||
$("#nextpic").click(function(){
|
||||
nextpic($(this));
|
||||
})
|
||||
|
||||
$(document).keydown(function(e){
|
||||
if (e.keyCode == 37){
|
||||
prevpic($rslidenav.find(".navP"));
|
||||
return false;
|
||||
}
|
||||
if(e.keyCode == 39){
|
||||
nextpic($rslidenav.find(".navN"));
|
||||
return false;
|
||||
}
|
||||
if(e.keyCode == 27){
|
||||
toggleFullscreen();
|
||||
$rslide.removeClass('browserFullScreen');
|
||||
return false;
|
||||
}
|
||||
if(e.keyCode == 70 || e.keyCode == 102){
|
||||
if($rslide.hasClass("fullscreen"))
|
||||
browserFullScreen();
|
||||
}
|
||||
});
|
||||
var browserFullScreen = function(){
|
||||
var el = document.documentElement,
|
||||
rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen;
|
||||
rfs.call(el);
|
||||
}
|
||||
$(window).resize(function(){
|
||||
if(window.innerWidth == screen.width && window.innerHeight == screen.height) {
|
||||
$rslide.addClass('browserFullScreen');
|
||||
} else {
|
||||
$rslide.removeClass('browserFullScreen');
|
||||
}
|
||||
})
|
||||
var nextpic = function(dom){
|
||||
if(imagecount == imageArray.length - 1)
|
||||
imagecount = 0;
|
||||
else
|
||||
imagecount++;
|
||||
changeImage(dom);
|
||||
}
|
||||
var prevpic = function(dom){
|
||||
if(imagecount == 0)
|
||||
imagecount = imageArray.length - 1
|
||||
else
|
||||
imagecount--;
|
||||
changeImage(dom);
|
||||
}
|
||||
var toggleFullscreen = function(){
|
||||
if($rslide.hasClass("fullscreen")){
|
||||
$rslide.css("position","relative");
|
||||
$rslide.removeClass("fullscreen");
|
||||
$(".slidectrl .browserfullscreen").hide();
|
||||
$img.css({"padding":""})
|
||||
$("#main_pic").height("auto");
|
||||
}else{
|
||||
$("#main_pic").height(wHeight);
|
||||
$img.css("height","auto");
|
||||
$rslide.css("position","");
|
||||
$rslide.addClass("fullscreen");
|
||||
$img.css({"padding":($rslide.height()-$img.height())/2})
|
||||
$(".slidectrl .browserfullscreen").show();
|
||||
}
|
||||
}
|
||||
var changeImage = function(dom){
|
||||
var pageurl = dom.attr('href');
|
||||
|
||||
$img.fadeOut(200,function(){
|
||||
g.loadstart();
|
||||
if($rslide.hasClass("fullscreen")){
|
||||
|
||||
$img.attr({"src":dom.attr("data-content")}).css("height","100%").load(function(){
|
||||
g.loadcomplete();
|
||||
$img.fadeIn(200);
|
||||
});
|
||||
}else{
|
||||
$img.attr({"src":dom.attr("data-content")}).css("height","auto").load(function(){
|
||||
g.loadcomplete();
|
||||
$img.fadeIn(200);
|
||||
});;
|
||||
}
|
||||
if($rslide.hasClass("fullscreen")){
|
||||
$img.css({"padding":($rslide.height()-$img.height())/2})
|
||||
}
|
||||
$slidelist.stop().animate({'height':'0px'}, 300);
|
||||
$slidelist.find("ul").hide();
|
||||
if(rcom.getInternetExplorerVersion() == -1){
|
||||
if(pageurl!=window.location){
|
||||
var segments = window.location.pathname.split("/"),
|
||||
uid = segments[segments.length-1];
|
||||
pageurl = window.location.pathname.replace(uid,"-"+pageurl)+"?method=theater";
|
||||
window.history.pushState({path:pageurl},'',pageurl);
|
||||
}
|
||||
}else{
|
||||
window.location.hash = pageurl;
|
||||
}
|
||||
// $(".slideinfo b.info").text(imageArray[imagecount].title);
|
||||
updatePhotoTag();
|
||||
if(imageArray[imagecount].description)
|
||||
$(".slideinfo .info").text(imageArray[imagecount].description);
|
||||
else
|
||||
$(".slideinfo .info").text("");
|
||||
if(imageArray.length > 1)
|
||||
updateNavigation();
|
||||
})
|
||||
|
||||
}
|
||||
var updateNavigation = function(){
|
||||
var next, prev;
|
||||
if(imagecount == 0){
|
||||
next = 1;
|
||||
prev = imageArray.length - 1;
|
||||
}else if(imagecount == imageArray.length - 1){
|
||||
next = 0
|
||||
prev = imageArray.length - 2;
|
||||
}else{
|
||||
next = imagecount + 1;
|
||||
prev = imagecount - 1;
|
||||
}
|
||||
$(".navN").attr({"href":imageArray[next]._id,"data-content":imageArray[next].file.theater.url});
|
||||
$(".navP").attr({"href":imageArray[prev]._id,"data-content":imageArray[prev].file.theater.url});
|
||||
};
|
||||
if(imageArray.length > 1)
|
||||
updateNavigation();
|
||||
}
|
||||
|
||||
var preparestage = function(albumid){
|
||||
$.getJSON("/admin/galleries/"+albumid+"/imgs", function(album){
|
||||
imageArray = eval(album.images);
|
||||
$.each(album.images,function(i,image){
|
||||
if(image._id == id)
|
||||
imagecount = i;
|
||||
})
|
||||
bindHandlers();
|
||||
})
|
||||
}
|
||||
// if(rcom.getInternetExplorerVersion()!=-1){
|
||||
// var url_constructor = window.location.href.split("/");
|
||||
// var url = "";
|
||||
// for(x=0;x<=url_constructor.length-1;x++){
|
||||
// if(x == url_constructor.length-1){
|
||||
// url+="#!/"+url_constructor[x];
|
||||
// }else{
|
||||
// url+=url_constructor[x]+"/";
|
||||
// }
|
||||
// }
|
||||
|
||||
// window.location.href = url;
|
||||
// }
|
||||
|
||||
var albumid = $("#main_pic").attr("data-content");
|
||||
g.albumArea.css("margin-bottom","0");
|
||||
// picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight());
|
||||
preparestage(albumid);
|
||||
|
||||
}
|
||||
this.loadcomplete = function(){
|
||||
g.loading.hide();
|
||||
}
|
||||
this.loadstart = function(){
|
||||
g.loading.show();
|
||||
}
|
||||
|
||||
}
|
||||
galleryAPI.prototype.locale = "en";
|
||||
@@ -0,0 +1 @@
|
||||
//= require galleryAPI
|
||||
@@ -0,0 +1,136 @@
|
||||
/* ===================================================
|
||||
* jquery-lite-image-resize v.1.0.1
|
||||
* https://github.com/RayChang/jquery-lite-image-resize
|
||||
* ===================================================
|
||||
* How to use ?
|
||||
*
|
||||
* HTML element closest to the image to add class "resizeimg".
|
||||
*
|
||||
* Example:
|
||||
* <div class="resizeimg">
|
||||
* <img src="images url" />
|
||||
* </div>
|
||||
*
|
||||
* Or you can use:
|
||||
* $('your class').rsImg();
|
||||
*
|
||||
* Note : HTML structure must be a structure like the example above.
|
||||
*
|
||||
*/
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var ResizeImg = function(element, elementLength, i) {
|
||||
this.element = $(element);
|
||||
this.element.data('exists', true);
|
||||
this.elementLength = elementLength;
|
||||
this.index = i;
|
||||
};
|
||||
ResizeImg.prototype.resize = function(callback) {
|
||||
var $img = this.element.children('img').eq(0),
|
||||
elW = this.element.innerWidth(),
|
||||
elH = this.element.innerHeight(),
|
||||
elScale = elW/elH,
|
||||
ell = this.elementLength,
|
||||
index = this.index,
|
||||
image = document.createElement("img");
|
||||
image.src = $img.attr('src');
|
||||
this.element.css({
|
||||
'position': 'relative',
|
||||
'overflow': 'hidden',
|
||||
});
|
||||
function imageLoadComplete() {
|
||||
var imgW = image.width,
|
||||
imgH = image.height,
|
||||
imgScale = imgW/imgH,
|
||||
portrait = {
|
||||
'position': 'absolute',
|
||||
'height': '100%',
|
||||
'width': 'auto',
|
||||
'max-width': 'none',
|
||||
'left': '50%',
|
||||
'top': 0,
|
||||
'margin-left': imgW*(elH/imgH)/-2
|
||||
},
|
||||
landscape = {
|
||||
'position': 'absolute',
|
||||
'height': 'auto',
|
||||
'max-height': 'none',
|
||||
'width': '100%',
|
||||
'left': 0,
|
||||
'top': '50%',
|
||||
'margin-top': imgH*(elW/imgW)/-2
|
||||
},
|
||||
center = {
|
||||
'position': 'absolute',
|
||||
'height': '100%',
|
||||
'width': '100%',
|
||||
'top': 0,
|
||||
'left': 0
|
||||
};
|
||||
if(imgScale < 1) {
|
||||
if(elScale < 1) {
|
||||
if(elScale > imgScale) {
|
||||
$img.css(landscape);
|
||||
} else {
|
||||
$img.css(portrait);
|
||||
};
|
||||
} else {
|
||||
$img.css(landscape);
|
||||
};
|
||||
};
|
||||
|
||||
if(imgScale > 1) {
|
||||
if(elScale > 1) {
|
||||
if(elScale > imgScale) {
|
||||
$img.css(landscape);
|
||||
} else {
|
||||
$img.css(portrait);
|
||||
};
|
||||
} else {
|
||||
$img.css(portrait);
|
||||
};
|
||||
};
|
||||
|
||||
if(imgScale == 1) {
|
||||
if(elScale < 1) {
|
||||
$img.css(portrait);
|
||||
} else if(elScale > 1) {
|
||||
$img.css(landscape);
|
||||
} else {
|
||||
$img.css(center);
|
||||
};
|
||||
};
|
||||
$img.fadeTo(500, 1);
|
||||
|
||||
if(index == ell && callback) {
|
||||
ResizeImg.prototype.callback(callback)
|
||||
}
|
||||
}
|
||||
if(/MSIE 8.0/g.test($ua)) {
|
||||
imageLoadComplete();
|
||||
} else {
|
||||
image.onload = imageLoadComplete;
|
||||
}
|
||||
};
|
||||
|
||||
ResizeImg.prototype.callback = function(callback) {
|
||||
callback();
|
||||
};
|
||||
|
||||
$.fn.rsImg = function (callback) {
|
||||
var elementLength = this.length - 1;
|
||||
this.each(function (i) {
|
||||
if(!$(this).data('exists')) {
|
||||
$(this).children("img").fadeTo(0,0);
|
||||
new ResizeImg(this, elementLength, i).resize(callback);
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
$(function() {
|
||||
$('.resizeimg').rsImg();
|
||||
});
|
||||
}(window.jQuery);
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* jQuery Masonry v2.1.08
|
||||
* A dynamic layout plugin for jQuery
|
||||
* The flip-side of CSS Floats
|
||||
* http://masonry.desandro.com
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* Copyright 2012 David DeSandro
|
||||
*/
|
||||
(function(e,t,n){"use strict";var r=t.event,i;r.special.smartresize={setup:function(){t(this).bind("resize",r.special.smartresize.handler)},teardown:function(){t(this).unbind("resize",r.special.smartresize.handler)},handler:function(e,t){var n=this,s=arguments;e.type="smartresize",i&&clearTimeout(i),i=setTimeout(function(){r.dispatch.apply(n,s)},t==="execAsap"?0:100)}},t.fn.smartresize=function(e){return e?this.bind("smartresize",e):this.trigger("smartresize",["execAsap"])},t.Mason=function(e,n){this.element=t(n),this._create(e),this._init()},t.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1,containerStyle:{position:"relative"}},t.Mason.prototype={_filterFindBricks:function(e){var t=this.options.itemSelector;return t?e.filter(t).add(e.find(t)):e},_getBricks:function(e){var t=this._filterFindBricks(e).css({position:"absolute"}).addClass("masonry-brick");return t},_create:function(n){this.options=t.extend(!0,{},t.Mason.settings,n),this.styleQueue=[];var r=this.element[0].style;this.originalStyle={height:r.height||""};var i=this.options.containerStyle;for(var s in i)this.originalStyle[s]=r[s]||"";this.element.css(i),this.horizontalDirection=this.options.isRTL?"right":"left";var o=this.element.css("padding-"+this.horizontalDirection),u=this.element.css("padding-top");this.offset={x:o?parseInt(o,10):0,y:u?parseInt(u,10):0},this.isFluid=this.options.columnWidth&&typeof this.options.columnWidth=="function";var a=this;setTimeout(function(){a.element.addClass("masonry")},0),this.options.isResizable&&t(e).bind("smartresize.masonry",function(){a.resize()}),this.reloadItems()},_init:function(e){this._getColumns(),this._reLayout(e)},option:function(e,n){t.isPlainObject(e)&&(this.options=t.extend(!0,this.options,e))},layout:function(e,t){for(var n=0,r=e.length;n<r;n++)this._placeBrick(e[n]);var i={};i.height=Math.max.apply(Math,this.colYs);if(this.options.isFitWidth){var s=0;n=this.cols;while(--n){if(this.colYs[n]!==0)break;s++}i.width=(this.cols-s)*this.columnWidth-this.options.gutterWidth}this.styleQueue.push({$el:this.element,style:i});var o=this.isLaidOut?this.options.isAnimated?"animate":"css":"css",u=this.options.animationOptions,a;for(n=0,r=this.styleQueue.length;n<r;n++)a=this.styleQueue[n],a.$el[o](a.style,u);this.styleQueue=[],t&&t.call(e),this.isLaidOut=!0},_getColumns:function(){var e=this.options.isFitWidth?this.element.parent():this.element,t=e.width();this.columnWidth=this.isFluid?this.options.columnWidth(t):this.options.columnWidth||this.$bricks.outerWidth(!0)||t,this.columnWidth+=this.options.gutterWidth,this.cols=Math.floor((t+this.options.gutterWidth)/this.columnWidth),this.cols=Math.max(this.cols,1)},_placeBrick:function(e){var n=t(e),r,i,s,o,u;r=Math.ceil(n.outerWidth(!0)/this.columnWidth),r=Math.min(r,this.cols);if(r===1)s=this.colYs;else{i=this.cols+1-r,s=[];for(u=0;u<i;u++)o=this.colYs.slice(u,u+r),s[u]=Math.max.apply(Math,o)}var a=Math.min.apply(Math,s),f=0;for(var l=0,c=s.length;l<c;l++)if(s[l]===a){f=l;break}var h={top:a+this.offset.y};h[this.horizontalDirection]=this.columnWidth*f+this.offset.x,this.styleQueue.push({$el:n,style:h});var p=a+n.outerHeight(!0),d=this.cols+1-c;for(l=0;l<d;l++)this.colYs[f+l]=p},resize:function(){var e=this.cols;this._getColumns(),(this.isFluid||this.cols!==e)&&this._reLayout()},_reLayout:function(e){var t=this.cols;this.colYs=[];while(t--)this.colYs.push(0);this.layout(this.$bricks,e)},reloadItems:function(){this.$bricks=this._getBricks(this.element.children())},reload:function(e){this.reloadItems(),this._init(e)},appended:function(e,t,n){if(t){this._filterFindBricks(e).css({top:this.element.height()});var r=this;setTimeout(function(){r._appended(e,n)},1)}else this._appended(e,n)},_appended:function(e,t){var n=this._getBricks(e);this.$bricks=this.$bricks.add(n),this.layout(n,t)},remove:function(e){this.$bricks=this.$bricks.not(e),e.remove()},destroy:function(){this.$bricks.removeClass("masonry-brick").each(function(){this.style.position="",this.style.top="",this.style.left=""});var n=this.element[0].style;for(var r in this.originalStyle)n[r]=this.originalStyle[r];this.element.unbind(".masonry").removeClass("masonry").removeData("masonry"),t(e).unbind(".masonry")}},t.fn.imagesLoaded=function(e){function u(){e.call(n,r)}function a(e){var n=e.target;n.src!==s&&t.inArray(n,o)===-1&&(o.push(n),--i<=0&&(setTimeout(u),r.unbind(".imagesLoaded",a)))}var n=this,r=n.find("img").add(n.filter("img")),i=r.length,s="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",o=[];return i||u(),r.bind("load.imagesLoaded error.imagesLoaded",a).each(function(){var e=this.src;this.src=s,this.src=e}),n};var s=function(t){e.console&&e.console.error(t)};t.fn.masonry=function(e){if(typeof e=="string"){var n=Array.prototype.slice.call(arguments,1);this.each(function(){var r=t.data(this,"masonry");if(!r){s("cannot call methods on masonry prior to initialization; attempted to call method '"+e+"'");returLine truncated
|
||||
@@ -0,0 +1,586 @@
|
||||
//Created by Harry Bomrah on Sep 21 2011
|
||||
$rss = jQuery.noConflict();
|
||||
var rcom={
|
||||
//Pass dom and will return binded dom with starting year till current
|
||||
insertDatePanel : function(dom,year){
|
||||
if(!year)year=1901;
|
||||
if(dom=="")return false;
|
||||
domid=dom.attr("id");
|
||||
var dt = new Date();
|
||||
current_year=dt.getFullYear();
|
||||
var dthtml="Year: <select name='"+domid+"_year'>";
|
||||
for(i=current_year;i>=year;i--){
|
||||
dthtml+="<option value='"+i+"'>"+i+"</option>";
|
||||
}
|
||||
dthtml+="</select> Date: <select name='"+domid+"_date'>";
|
||||
for(i=1;i<=31;i++){
|
||||
if(i<10)
|
||||
dthtml+="<option value='0"+i+"'>"+i+"</option>";
|
||||
else
|
||||
dthtml+="<option value='"+i+"'>"+i+"</option>";
|
||||
}
|
||||
dthtml+="</select> Month: <select name='"+domid+"_month'>";
|
||||
var months= Array("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
|
||||
for(i=1;i<12;i++){
|
||||
if(i<10)
|
||||
dthtml+="<option value='0"+i+"'>"+months[i]+"</option>";
|
||||
else
|
||||
dthtml+="<option value='"+i+"'>"+months[i]+"</option>";
|
||||
}
|
||||
dthtml+="</select>";
|
||||
dom.html(dthtml);
|
||||
},
|
||||
|
||||
//loading overlay around a dom...
|
||||
loadingWrapper : function(dom, display){
|
||||
if(display){
|
||||
dom.prepend("<div id='loading_wrapper' class='loading'></div>");
|
||||
$rss("#loading_wrapper").height(dom.height());
|
||||
$rss("#loading_wrapper").width(dom.width());
|
||||
}else{
|
||||
domId=dom.attr("id");
|
||||
$rss("#"+domId+" #loading_wrapper").remove();
|
||||
}
|
||||
},
|
||||
|
||||
//validating a dom....
|
||||
validate : function(dom, validation, errormsg){
|
||||
var domValue = dom.val();
|
||||
var error = false;
|
||||
var regex="";
|
||||
var msg = "";
|
||||
switch(validation){
|
||||
case "required":
|
||||
if(domValue=="")error=true;
|
||||
msg="Cannot be empty.";
|
||||
break;
|
||||
case "email":
|
||||
regex=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
|
||||
msg="Invalid Email Address.";
|
||||
break;
|
||||
case "number":
|
||||
regex=/^\d*[0-9](|.\d*[0-9]|,\d*[0-9])?$/;
|
||||
msg = "Only numbers are accepted.";
|
||||
break;
|
||||
case "alphanumeric":
|
||||
regex=/^\s*[a-zA-Z0-9,\s]+\s*$/;
|
||||
msg="Only numbers, alphabets and spaces are allowed.";
|
||||
break;
|
||||
}
|
||||
domId=dom.attr("name");
|
||||
if(errormsg=="")errormsg=msg;
|
||||
if(regex!="")if(!regex.test(domValue))error=true;
|
||||
if(error){$rss("#"+domId+"_error").remove();dom.after("<span id='"+domId+"_error' class='error'>"+errormsg+"</span>");return false;} else{ $rss("#"+domId+"_error").remove();return true;}
|
||||
},
|
||||
|
||||
bindToSpinner : function(dom,data,callbackFn){
|
||||
var domId = dom.attr("id");
|
||||
var dhtml="";
|
||||
var spinnerValue=Array();
|
||||
var spinnerDisplay=Array();
|
||||
$rss.each(data,function(i,it){
|
||||
$rss.each(data[i],function(key,it){
|
||||
spinnerValue.push(it);
|
||||
});
|
||||
});
|
||||
dhtml="<select name='"+domId+"'>";
|
||||
for(i=0,y=1,z=0;i<spinnerValue.length/2;i++,y+=2,z+=2){
|
||||
dhtml+="<option value='"+spinnerValue[z]+"'>"+spinnerValue[y]+"</option>";
|
||||
}
|
||||
dhtml+="</select>";
|
||||
dom.html(dhtml);
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this, dhtml);
|
||||
},
|
||||
|
||||
//binds the recieved json to a table
|
||||
bindToTable : function(dom,data,headers,actions,css_class,callbackFn){
|
||||
if(!css_class)css_class="";
|
||||
var dhtml="<table width='100%' cellpadding='5' cellspacing='5' class='"+css_class+"' ><thead><tr>";
|
||||
var domId = dom.attr("id");
|
||||
if(actions){
|
||||
var btnTitles=Array();
|
||||
var btnFunctions=Array();
|
||||
$rss.each(actions,function(title,func){
|
||||
btnTitles.push(title);
|
||||
btnFunctions.push(func);
|
||||
});
|
||||
rcom.translate(btnTitles,function(convertedData){
|
||||
btnTitles=convertedData.slice();
|
||||
|
||||
rcom.translate(headers,function(convertedData){
|
||||
headers=convertedData;
|
||||
if(!data)return;
|
||||
$rss.each(headers,function(i,head){
|
||||
dhtml+="<th>"+head+"</th>";
|
||||
});
|
||||
dhtml+="</thead></tr>";
|
||||
if(data.length==0)dhtml+="<tr><td colspan='"+headers.length+"' align='center'>No Data</td></tr>";
|
||||
$rss.each(data,function(i,item){
|
||||
var cl="";
|
||||
if(i%2!=0)cl="even";
|
||||
dhtml+="<tr id='"+domId+"_"+item.id+"' class='"+cl+"'>";
|
||||
$rss.each(item,function(i,it){
|
||||
if(i!="id"){
|
||||
if(it==null)it="Not Set";
|
||||
dhtml+="<td align='center'>"+it+"</td>";
|
||||
}
|
||||
})
|
||||
dhtml+="<td align='center'>";
|
||||
for(x=0;x<btnTitles.length;x++){
|
||||
dhtml+="<button onclick='"+btnFunctions[x]+"("+item.id+")'>"+btnTitles[x]+"</button>";
|
||||
}
|
||||
dhtml+="</td>";
|
||||
dhtml+="</tr>";
|
||||
});
|
||||
dhtml+="</table>";
|
||||
dom.html(dhtml);
|
||||
});
|
||||
});
|
||||
}else{
|
||||
rcom.translate(headers,function(convertedData){
|
||||
headers=convertedData;
|
||||
if(!data)return;
|
||||
if(headers.length>0){
|
||||
$rss.each(headers,function(i,head){
|
||||
dhtml+="<th>"+head+"</th>";
|
||||
});
|
||||
}
|
||||
dhtml+="</thead></tr>";
|
||||
if(data.length==0)dhtml+="<tr><td colspan='"+headers.length+"' align='center'>No Data</td></tr>";
|
||||
|
||||
$rss.each(data,function(i,item){
|
||||
var cl="";
|
||||
if(i%2!=0)cl="even";
|
||||
dhtml+="<tr id='"+domId+"_"+item.id+"' class='"+cl+"'>";
|
||||
$rss.each(item,function(i,it){
|
||||
if(i!="id"){
|
||||
if(it==null)it="Not Set";
|
||||
dhtml+="<td align='center'>"+it+"</td>";
|
||||
}
|
||||
})
|
||||
dhtml+="</tr>";
|
||||
});
|
||||
dhtml+="</table>";
|
||||
dom.html(dhtml);
|
||||
});
|
||||
}
|
||||
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this, dhtml);
|
||||
},
|
||||
//convert to date string which can be directly inserted in database or according to any format.
|
||||
convertToInsertableDate : function(y,m,d,format){
|
||||
var dt="";
|
||||
if(m<10)m="0"+m;
|
||||
if(d<10)d="0"+d;
|
||||
switch(format){
|
||||
case "yyyy-mm-dd":
|
||||
dt= y+"-"+m+"-"+d;
|
||||
break;
|
||||
case "dd-mm-yyyy":
|
||||
dt= d+"-"+m+"-"+y;
|
||||
break;
|
||||
case "mm-dd-yyyy":
|
||||
dt= m+"-"+d+"-"+y;
|
||||
break;
|
||||
default:
|
||||
dt= y+"-"+m+"-"+d;
|
||||
break;
|
||||
}
|
||||
return dt;
|
||||
},
|
||||
//a fucntion to show specific divs and hide all other
|
||||
showDoms : function(doms){
|
||||
$rss("body").find("div").each(function(){$rss(this).hide();});
|
||||
$rss.each(doms,function(i,dom){
|
||||
dom.show();
|
||||
});
|
||||
},
|
||||
|
||||
//a function to translate the word or array..
|
||||
translate : function(data,callbackFn){
|
||||
var cdata="";
|
||||
var status =true;
|
||||
if(!data){
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this,cdata);
|
||||
status=false;
|
||||
}
|
||||
if(data==""){
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this,cdata);
|
||||
status=false;
|
||||
}
|
||||
if(status){
|
||||
$rss.getJSON("../../classes/translate.php", {fn:"translateThis",tData:data},function(convertedData){
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this, convertedData);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// a function to bind JSON to list
|
||||
bindToList : function(dom,data,callbackFn){
|
||||
var domId = dom.attr("id");
|
||||
var dhtml="";
|
||||
var listValue=Array();
|
||||
var listDisplay=Array();
|
||||
$rss.each(data,function(i,it){
|
||||
$rss.each(data[i],function(key,it){
|
||||
listValue.push(it);
|
||||
});
|
||||
});
|
||||
dhtml="<ul id='"+domId+"_list'>";
|
||||
for(i=0,y=1,z=0;i<listValue.length/2;i++,y+=2,z+=2){
|
||||
dhtml+="<li id='li_"+listValue[z]+"'>"+listValue[y]+"</li>";
|
||||
}
|
||||
dhtml+="</ul>";
|
||||
dom.html(dhtml);
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this,dhtml);
|
||||
},
|
||||
makeDraggable : function(handler,dom){
|
||||
handler.css("position","absolute");
|
||||
dom.css("position","absolute");
|
||||
var puranix=0;
|
||||
var nayeex=0;
|
||||
var puraniy=0;
|
||||
var nayeey=0;
|
||||
var offset="";
|
||||
var zIndex=dom.css("z-index");
|
||||
handler.mousedown(function(e){
|
||||
puranix=e.clientX;
|
||||
puraniy=e.clientY;
|
||||
offset=dom.offset();
|
||||
$rss(this).mousemove(function(e){
|
||||
nayeex=e.clientX-puranix;
|
||||
nayeex+=offset.left;
|
||||
nayeey=e.clientY-puraniy;
|
||||
nayeey+=offset.top;
|
||||
dom.css({"left":nayeex+"px","top":nayeey+"px","z-index":"9999"});
|
||||
})
|
||||
}).mouseup(function(){
|
||||
$rss(this).unbind("mousemove");
|
||||
dom.css("z-index",zIndex);
|
||||
})
|
||||
},
|
||||
|
||||
//automatically scrolls to the bottom of the div
|
||||
scrollToBottom : function(dom){
|
||||
var domId = dom.attr("id");
|
||||
// var domScrollHeight = document.getElementById(domId).scrollHeight;
|
||||
var obj = document.getElementById(domId);
|
||||
|
||||
if((obj.scrollTop+100) >= (obj.scrollHeight - obj.offsetHeight))
|
||||
dom.scrollTop(obj.scrollHeight);
|
||||
},
|
||||
|
||||
/*ajax loading of images... needs following settings
|
||||
dom:in which images ve to be loaded
|
||||
url:the server url for making ajax calls
|
||||
limit:how many images to load
|
||||
divClass:the class of div surrounding each image
|
||||
nameClass:class for span showing name
|
||||
fn:function to be called in on the server
|
||||
imageSrc:the image source of all the images.
|
||||
bindTo:to bind images to a onclick function or else will be binded to normal a tag.
|
||||
urlKey:to specify the key of the value.. if bindTo is used, this will be neglected..
|
||||
returns json;
|
||||
*/
|
||||
loadImages : function(settings,callbackFn){
|
||||
|
||||
var dom = settings.dom;
|
||||
var domid= dom.attr("id");
|
||||
var temp_array=Array();
|
||||
var starting = $rss("#"+domid+" img:last").attr("id");
|
||||
if(typeof starting != 'undefined'){
|
||||
starting = starting.substr(4,starting.length-1);
|
||||
}else{starting = 0};
|
||||
var temp_var="";
|
||||
var json = "";
|
||||
var dhtml="";
|
||||
var extraparam="";
|
||||
if(typeof settings.extraParam != "undefined"){
|
||||
extraparam = settings.extraParam;
|
||||
}
|
||||
$rss.getJSON(settings.url,{fn:settings.fn,id:settings.whereId,limit:settings.limit,start:starting,extra:extraparam},function(images){
|
||||
json = eval(images);
|
||||
$rss.each(images,function(i,pic){
|
||||
var temp_array=Array();
|
||||
var a_var=Array();
|
||||
var name_var="";
|
||||
var title="";
|
||||
$rss.each(pic,function(i,value){
|
||||
temp_array.push(value);
|
||||
})
|
||||
if(temp_array.length>=4){
|
||||
name_var="<span class='"+settings.nameClass+"'>"+temp_array[3]+"</span></div>"
|
||||
}
|
||||
if(temp_array[2]==null)
|
||||
title = "";
|
||||
else
|
||||
title = temp_array[2];
|
||||
if(typeof settings.bindTo!="undefined"){
|
||||
a_var[1]="onclick='"+settings.bindTo+"("+temp_array[0]+");return false;'";
|
||||
a_var[0]="";
|
||||
}else{a_var[0]='?'+settings.urlKey+'='+temp_array[0];a_var[1]="";}
|
||||
dhtml="<div class='"+settings.divClass+"' id='img_holder_"+temp_array[0]+"' ><a href='"+a_var[0]+"' "+a_var[1]+" title='"+title+"'><img id='pic_"+temp_array[0]+"' style='display:none' src='"+settings.imageSrc+temp_array[1]+"' /></a>"+name_var;
|
||||
dom.delay(100).append(dhtml);
|
||||
$rss("#pic_"+pic.id).delay(100).fadeIn(200);
|
||||
|
||||
})
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this,json);
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
|
||||
//function to get url variables...
|
||||
getUrlVars : function(){
|
||||
var vars = [], hash;
|
||||
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
|
||||
for(var i = 0; i < hashes.length; i++){
|
||||
hash = hashes[i].split('=');
|
||||
vars.push(hash[0]);
|
||||
vars[hash[0]] = hash[1];
|
||||
}
|
||||
if(vars[0] == window.location.href){
|
||||
vars =[];
|
||||
}
|
||||
return vars;
|
||||
},
|
||||
/*function to open a modalwindow on a page.. self reliant no images, no css needed.
|
||||
settings
|
||||
|
||||
width:in percentage or pixcel
|
||||
height:in percentage or pixcel
|
||||
closeBtn:true or false
|
||||
envClose:closing through background click, true or flase
|
||||
loadDiv:load html from a div
|
||||
loadPage:load a page
|
||||
loadHtml: load html
|
||||
|
||||
*/
|
||||
modalWindow : function(settings,callbackFn){
|
||||
|
||||
var envClose = settings.envClose;
|
||||
var dhtml="";
|
||||
if(typeof envClose == "undefined")
|
||||
envClose = true;
|
||||
var closeBtn = settings.closeBtn;
|
||||
if(typeof closeBtn == "undefined")
|
||||
closeBtn = true;
|
||||
|
||||
var rgmaskHeight = $rss(window).height();
|
||||
var rgmaskWidth = $rss(window).width();
|
||||
var tempheight = settings.height;
|
||||
var tempwidth = settings.width;
|
||||
|
||||
var maxheight = (rgmaskHeight*85)/100;
|
||||
var maxwidth = (rgmaskWidth*85)/100;
|
||||
|
||||
if(typeof tempheight!="undefined"){
|
||||
tempheight = tempheight.toString();
|
||||
if(tempheight.charAt(tempheight.length-1)=='%')
|
||||
tempheight=(rgmaskHeight*parseInt(tempheight.substr(0,tempheight.length)))/100;
|
||||
if(tempheight>maxheight)
|
||||
tempheight=maxheight;
|
||||
}else{tempheight="auto";}
|
||||
if(typeof tempwidth!="undefined"){
|
||||
tempwidth = tempwidth.toString();
|
||||
if(tempwidth.charAt(tempwidth.length-1)=='%')
|
||||
tempwidth=(rgmaskWidth*parseInt(tempwidth.substr(0,tempwidth.length)))/100;
|
||||
if(tempwidth>maxwidth)
|
||||
tempwidth=maxwidth;
|
||||
}else{tempwidth="auto";}
|
||||
$rss("body").append('<div class="rgmask" id="rgsheath" style="height:'+rgmaskHeight+'px"></div>');
|
||||
$rss("#rgsheath").css({background: "#000", width: "100%", position: "fixed", top: 0, left: 0,opacity:0.5,'z-index':199});
|
||||
$rss("body").append('<div id="rgWindow"></div>');
|
||||
$rss("#rgWindow").css({"position": "fixed", "z-index": "999", "background": "#fff", "border": "solid 1px #ccc", "padding": "10px", "border-radius": "5px", "-webkit-border-radius": "5px", "-moz-border-radius": "5px", "-ms-border-radius": "5px", "box-shadow": "0 0 20px rgba(0,0,0,0.7)","-webkit-box-shadow": "0 0 20px rgba(0,0,0,0.7)","-moz-box-shadow": "0 0 20px rgba(0,0,0,0.7)","-ms-box-shadow": "0 0 20px rgba(0,0,0,0.7)"});
|
||||
var rgWTop = (rgmaskHeight-20)/2;
|
||||
var rgWLeft = (rgmaskWidth-20)/2;
|
||||
$rss("#rgWindow").css({top:rgWTop+"px", left:rgWLeft+"px"});
|
||||
if(typeof settings.loadDiv!="undefined"){
|
||||
dhtml = $rss(settings.loadDiv).html();
|
||||
$rss("#rgWindow").html(dhtml).hide();
|
||||
prepareWindow();
|
||||
}
|
||||
if(typeof settings.loadHtml!="undefined"){
|
||||
dhtml = settings.loadHtml;
|
||||
$rss("#rgWindow").html(dhtml).hide();
|
||||
prepareWindow();
|
||||
}
|
||||
if(typeof settings.loadPage!="undefined"){
|
||||
$rss("#rgWindow").load(settings.loadPage,function(){$rss(this).hide();dhtml=$rss(this).html();prepareWindow();});
|
||||
}
|
||||
function prepareWindow(){
|
||||
if(tempheight!="auto")
|
||||
rgWTop = (rgmaskHeight-tempheight)/2;
|
||||
else{
|
||||
tempheight=$rss("#rgWindow").height()+30;
|
||||
if(tempheight>maxheight)
|
||||
tempheight=maxheight;
|
||||
rgWTop=(rgmaskHeight-tempheight)/2;
|
||||
}
|
||||
if(tempwidth!="auto")
|
||||
rgWLeft = (rgmaskWidth-tempwidth)/2;
|
||||
else{
|
||||
tempwidth=$rss("#rgWindow").width();
|
||||
if(tempwidth>maxwidth)
|
||||
tempwidth=maxwidth;
|
||||
rgWLeft=(rgmaskWidth-tempwidth)/2;
|
||||
}
|
||||
tempwidth=parseInt(tempwidth)+25;
|
||||
$rss("#rgWindow").empty().show();
|
||||
var closebtn = "";
|
||||
if(closeBtn)
|
||||
closebtn='<a href="" style="display:block; width:20px; height:20px; line-height:19px; text-align:center; position:absolute; right:-10px; top: -10px; font-family:Tahoma; font-weight:bold; border:solid 1px #000; border-radius: 10px;text-shadow:0px 1px 0 #DDD; background-color:#CCC; font-size:10px; text-decoration:none; color:#666; padding-left:1px; box-shadow: 0 0 5px #000000;" id="close_modal">X</a>';
|
||||
$rss("#rgWindow").animate({"width":tempwidth+"px","height":tempheight+"px",top:rgWTop+"px", left:rgWLeft+"px"},500,function(){$rss("#rgWindow").html(closebtn+"<div id='rgContent' style='padding:5px; overflow:auto; overflow-x:none; height:"+tempheight+"px;'>"+dhtml+"</div>");
|
||||
$rss("#close_modal").mouseover(function(){$rss(this).css("color","#999");}).mouseout(function(){$rss(this).css("color","#666");})
|
||||
$rss("#close_modal").click(function(){rcom.modalWindowClose(); return false;})
|
||||
if(envClose)
|
||||
$rss("#rgsheath").click(function(){
|
||||
rcom.modalWindowClose();
|
||||
})
|
||||
$rss(document).one("keydown",function(e){
|
||||
if (e.keyCode == 27){
|
||||
rcom.modalWindowClose();
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this,$rss("#rgWindow"));
|
||||
});
|
||||
}
|
||||
},
|
||||
modalWindowUpdate : function(settings,callbackFn){
|
||||
var rgmaskHeight = $rss(window).height();
|
||||
var rgmaskWidth = $rss(window).width();
|
||||
var tempheight = settings.height;
|
||||
var tempwidth = settings.width;
|
||||
var dhtml = "";
|
||||
var maxheight = (rgmaskHeight*85)/100;
|
||||
var maxwidth = (rgmaskWidth*85)/100;
|
||||
if(typeof tempheight!="undefined"){
|
||||
tempheight = tempheight.toString();
|
||||
if(tempheight.charAt(tempheight.length-1)=='%')
|
||||
tempheight=(rgmaskHeight*parseInt(tempheight.substr(0,tempheight.length)))/100;
|
||||
if(tempheight>maxheight)
|
||||
tempheight=maxheight;
|
||||
}else{tempheight="auto";}
|
||||
if(typeof tempwidth!="undefined"){
|
||||
tempwidth = tempwidth.toString();
|
||||
if(tempwidth.charAt(tempwidth.length-1)=='%')
|
||||
tempwidth=(rgmaskWidth*parseInt(tempwidth.substr(0,tempwidth.length)))/100;
|
||||
if(tempwidth>maxwidth)
|
||||
tempwidth=maxwidth;
|
||||
}else{tempwidth="auto";};
|
||||
$rss("body").append("<div id='rgwindow_temp_div'></div>");
|
||||
|
||||
if(typeof settings.loadDiv!="undefined"){
|
||||
dhtml = $rss("#"+settings.loadDiv).html();
|
||||
$rss("#rgwindow_temp_div").html(dhtml).hide();
|
||||
prepareWindow();
|
||||
}
|
||||
if(typeof settings.loadHtml!="undefined"){
|
||||
dhtml = settings.loadHtml;
|
||||
$rss("#rgwindow_temp_div").html(dhtml).hide();
|
||||
prepareWindow();
|
||||
}
|
||||
if(typeof settings.loadPage!="undefined"){
|
||||
$rss("#rgwindow_temp_div").load(settings.loadPage,function(){$rss(this).hide();dhtml=$rss(this).html();prepareWindow();});
|
||||
}
|
||||
function prepareWindow(){
|
||||
if(tempheight!="auto")
|
||||
rgWTop = (rgmaskHeight-tempheight)/2;
|
||||
else{
|
||||
tempheight=$rss("#rgwindow_temp_div").height()+30;
|
||||
if(tempheight>maxheight)
|
||||
tempheight=maxheight;
|
||||
rgWTop=(rgmaskHeight-tempheight)/2;
|
||||
}
|
||||
if(tempwidth!="auto")
|
||||
rgWLeft = (rgmaskWidth-tempwidth)/2;
|
||||
else{
|
||||
tempwidth=$rss("#rgwindow_temp_div").width();
|
||||
if(tempwidth>maxwidth)
|
||||
tempwidth=maxwidth;
|
||||
rgWLeft=(rgmaskWidth-tempwidth)/2;
|
||||
}
|
||||
tempwidth=parseInt(tempwidth)+25;
|
||||
$rss("#rgContent").empty();
|
||||
$rss("#rgWindow").animate({"width":tempwidth+"px","height":tempheight+"px",top:rgWTop+"px", left:rgWLeft+"px"},500,function(){$rss("#rgContent").css("height",tempheight+"px").html(dhtml)});
|
||||
$rss("#rgwindow_temp_div").remove();
|
||||
}
|
||||
},
|
||||
modalWindowClose : function(callbackFn){
|
||||
if($rss("#rgWindow").length>0){
|
||||
$rss("#rgWindow").empty();
|
||||
var rgmaskHeight = $rss(window).height();
|
||||
var rgmaskWidth = $rss(window).width();
|
||||
var x = (rgmaskHeight-20)/2;
|
||||
var y = (rgmaskWidth-20)/2
|
||||
$rss("#rgWindow").animate({top:x+"px", left:y+"px","width":"50px","height":"50px"},300,function(){$rss(this).fadeOut(100).remove();$rss("#rgsheath").fadeOut(500).remove();})
|
||||
}
|
||||
if(typeof callbackFn=="function")
|
||||
callbackFn.call(this,"harry");
|
||||
},
|
||||
bindDomToHead : function(dom){
|
||||
var gc = dom.css("background");
|
||||
var t = dom.offset();
|
||||
var gw = dom.width();
|
||||
$rss(window).scroll(function(){
|
||||
var wt = $rss(window).scrollTop();
|
||||
if ( wt > t.top ) {
|
||||
var cssObj = {
|
||||
'position':'fixed',
|
||||
'top':0,
|
||||
'width':gw,
|
||||
'background':gc,
|
||||
'box-shadow':'0 1px 0 rgba(0,0,0,0.2)',
|
||||
'z-index':99
|
||||
}
|
||||
dom.css(cssObj);
|
||||
} else {
|
||||
dom.attr('style',"");
|
||||
}
|
||||
});
|
||||
},
|
||||
progressBar : function(dom,settings){
|
||||
var domid = dom.prop("id");
|
||||
if($rss("#rss_progressbar_div_"+domid).length==0){
|
||||
if(typeof settings.top == "undefined")
|
||||
settings.value = 1;
|
||||
if(typeof settings.top == "undefined")
|
||||
settings.top = (dom.height()-12)/2;
|
||||
dom.append("<div id='rss_progressbar_div_"+domid+"' style='display:none;padding: 2px;background: #333;background: -webkit-linear-gradient(#111, #333);background: -moz-linear-gradient(#111, #333);background: -ms-linear-gradient(#111, #333);position: absolute;top: "+settings.top+"px;left: 50%;margin-left: -45%;width: 84%;box-shadow: inset 0 0 2px #000;border-radius: 4px;'><div id='rss_progressbar_"+domid+"' style='height: 8px; background: #36c;background: -webkit-linear-gradient(#7A98E7, #36c);background: -moz-linear-gradient(#7A98E7, #36c);background: -ms-linear-gradient(#7A98E7, #36c);border-radius: 2px; width: "+settings.value+"%;'></div></div>");
|
||||
$rss("#rss_progressbar_div_"+domid).fadeIn(500);
|
||||
}
|
||||
},
|
||||
progressBarValue : function(dom,value){
|
||||
var domid = dom.prop("id");
|
||||
if($rss("#rss_progressbar_div_"+domid).length==1){
|
||||
$rss("#rss_progressbar_"+domid).animate({"width":value+"%"},100);
|
||||
|
||||
}
|
||||
},
|
||||
progressBarClose : function(dom){
|
||||
var domid = dom.prop("id");
|
||||
$rss("#rss_progressbar_div_"+domid).fadeOut(500,function(){$(this).remove();});
|
||||
},
|
||||
getInternetExplorerVersion: function(){
|
||||
var rv = -1; // Return value assumes failure.
|
||||
if (navigator.appName == 'Microsoft Internet Explorer')
|
||||
{
|
||||
var ua = navigator.userAgent;
|
||||
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
|
||||
if (re.exec(ua) != null)
|
||||
rv = parseFloat( RegExp.$1 );
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
$ = jQuery.noConflict();
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
//https://github.com/blueimp/jQuery-File-Upload
|
||||
|
||||
$(function () {
|
||||
|
||||
'use strict';
|
||||
// Initialize the jQuery File Upload widget:
|
||||
$('#fileupload').fileupload({
|
||||
acceptFileTypes:/(\.|\/)(jpe?g|png)$/i,
|
||||
headers:{
|
||||
'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content")
|
||||
}
|
||||
});
|
||||
$('#fileupload').bind("fileuploadadd",function(e,data){$(".fileupload-content").css("background-image","none");})
|
||||
// Load existing files:
|
||||
/* $.getJSON($('#fileupload form').prop('action'),{albumid:pagevars['id']}, function (files) {
|
||||
var fu = $('#fileupload').data('fileupload');
|
||||
fu._adjustMaxNumberOfFiles(-files.length);
|
||||
fu._renderDownload(files)
|
||||
.appendTo($('#fileupload .files'))
|
||||
.fadeIn(function () {
|
||||
// Fix for IE7 and lower:
|
||||
$(this).show();
|
||||
});
|
||||
});
|
||||
*/
|
||||
// Open download dialogs via iframes,
|
||||
// to prevent aborting current uploads:
|
||||
$('#fileupload .files').delegate(
|
||||
'a:not([target^=_blank])',
|
||||
'click',
|
||||
function (e) {
|
||||
e.preventDefault();
|
||||
$('<iframe style="display:none;"></iframe>')
|
||||
.prop('src', this.href)
|
||||
.appendTo('body');
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
Reference in new issue
Block a user