You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
3.6 KiB
149 lines
3.6 KiB
var EXPO = EXPO || {}; //isolated namespace
|
|
//общий для всех страниц модуль Функционал общий для всех страниц
|
|
// module requires JQuery library
|
|
EXPO.placePhoto = (function() {
|
|
// variables
|
|
var that = {};
|
|
that.settings = {
|
|
|
|
}; //default module setting
|
|
that.lang ={};
|
|
//dependences
|
|
|
|
//private
|
|
// constructor for popup window on gallery page
|
|
var ModalBox = function(){
|
|
// object properties
|
|
this.rawData;
|
|
this.currentId;
|
|
// привязка к html данным шаблона формы
|
|
this.control;
|
|
};
|
|
//methods for ModalBox object
|
|
ModalBox.prototype = {
|
|
//some kind of 'protected' methods
|
|
_getAjax: function () {
|
|
|
|
},
|
|
_renderSlide: function () {
|
|
|
|
},
|
|
_getId: function () {
|
|
|
|
},
|
|
//public methods
|
|
close: function () {
|
|
|
|
},
|
|
open: function () {
|
|
|
|
},
|
|
nextSlide:function () {
|
|
|
|
},
|
|
prevSlide: function () {
|
|
|
|
},
|
|
// method to get sliderPopup visible and pass to modalBox first initial id and make some init routine
|
|
show: function () {
|
|
|
|
}
|
|
|
|
};
|
|
// methods
|
|
//инициализация общих свойств
|
|
that.init = function(options) {
|
|
// settings extending
|
|
$.extend(this.lang, options.lang);
|
|
options.lang = null;
|
|
$.extend(this.settings, options);
|
|
// begin of initialization
|
|
var self = this;
|
|
$(function () {
|
|
$('a.open-photo').on('click', function () {
|
|
var $popupGallery = $('#pw-gallery');
|
|
// configure image
|
|
var $img = $(this).find('img').clone();
|
|
$img.addClass('photoTag');
|
|
|
|
$img_block = $popupGallery.find('.pg-photos');
|
|
$img_block.html($img);
|
|
|
|
// add id for image description
|
|
var id = 'imgid'+$img.attr('data-image-id')
|
|
$popupGallery.find('.pg-photo-descr').attr('id', id);
|
|
$popupGallery.find('.pg-photo-descr ul').remove();
|
|
|
|
$popupGallery.find('.pg-photo-title').html($img.attr('data-image-name'))
|
|
$popupGallery.find('.pg-photo-text').html($img.attr('data-image-description'))
|
|
// end configure image
|
|
|
|
// Список людей для автокомплита:
|
|
|
|
$.getJSON('/accounts/get-tag-users/',function(json){
|
|
window.photoTagData = json;
|
|
});
|
|
|
|
|
|
|
|
// отметки
|
|
$('.photoTag').photoTag({
|
|
externalAddTagLinks: {
|
|
bind: true,
|
|
selector: ".addTag"
|
|
},
|
|
requestTagsUrl: '/photo/existing-tags/',
|
|
deleteTagsUrl: '/photo/delete-tag/',
|
|
addTagUrl: '/photo/add-tag/',
|
|
parametersForNewTag: {
|
|
name: {
|
|
parameterKey: 'name',
|
|
isAutocomplete: true,
|
|
label: 'Введите имя:'
|
|
}
|
|
}
|
|
});
|
|
// ---------------------------------------
|
|
|
|
var $popupOuter = $('div.popup-gallery-outer', $popupGallery);
|
|
var $closePopup = $('a.pg-close', $popupGallery);
|
|
var $prevSlide = $('a.pgpc-prev', $popupGallery);
|
|
var $nextSlide = $('a.pgpc-next', $popupGallery);
|
|
|
|
|
|
function closeGallery() {
|
|
$popupGallery.fadeOut(300, function () {
|
|
$body.removeClass('no-scroll');
|
|
});
|
|
return false;
|
|
}
|
|
|
|
$closePopup.on('click', closeGallery);
|
|
$popupOuter.on('click', function (event) {
|
|
var targetObj = $(event.target);
|
|
if (targetObj.parents().filter('.popup-gallery').length < 1) {
|
|
closeGallery()
|
|
}
|
|
});
|
|
|
|
$prevSlide.on('click', function () {
|
|
return false;
|
|
});
|
|
|
|
$nextSlide.on('click', function () {
|
|
return false;
|
|
});
|
|
|
|
$body.addClass('no-scroll');
|
|
$popupGallery.fadeIn(300);
|
|
|
|
return false;
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
return that;
|
|
}()); |