primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1,119 @@
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
/**
* this file manages the js script for adding/removing attachements in event
*/
// window.addEvent('domready', function() {
jQuery(document).ready(function ($) {
$('.attach-field').on('change', addattach);
$('.clear-attach-field').on('click', clearattach);
$('.attach-remove').on('click', function (event) {
var event = event || window.event;
// $(event.target).style.cursor = 'wait'; /* indicate server request */
// $(event.target).style.cursor = 'wait'; /* indicate server request */
$(this).css({'cursor': 'wait'})
var clickednode = event.target;
if (!clickednode.hasAttribute('id')) {
clickednode = $(this).parent();
}
var url = '';
// var pos = clickednode.id.indexOf(':');
var pos = $(this).attr('id').indexOf(':');
if (pos >= 0) {
// var id = clickednode.id.substring(13, pos);
// var token = clickednode.id.substr(pos+1);
var id = $(this).attr('id').substring(13, pos);
var token = $(this).attr('id').substr(pos + 1);
url = 'index.php?option=com_jem&task=ajaxattachremove&format=raw&id=' + id + '&' + token + '=1';
} else {
// var id = clickednode.id.substr(13);
var id = $(this).attr('id').substr(13);
url = 'index.php?option=com_jem&task=ajaxattachremove&format=raw&id=' + id;
}
// var theAjax = new Request( {
// url : url,
// method: 'post',
// postBody : ''
// });
// theAjax.addEventListener('onSuccess', function(response) {
// /* server sends 1 on success, 0 on error */
// if (response.indexOf('1') > -1) {
// $(clickednode).getParent().getParent().dispose();
// } else {
// $(clickednode).style.cursor = 'not-allowed'; /* remove failed - how to show? */
// }
// }.bind(this));
// theAjax.send();
$.ajax({
url: url,
method: 'post',
data: '',
success: function (response) {
if (response.indexOf('1') > -1) {
// $(clickednode).getParent().getParent().dispose();
$(clickednode).parent().parent().remove();
} else {
// $(clickednode).style.cursor = 'not-allowed'; /* remove failed - how to show? */
$(clickednode).css({'cursor': 'not-allowed'})
}
}
})
});
});
function addattach() {
// var tbody = $('#el-attachments').getElement('tbody');
var tbody = $('#el-attachments tbody');
// var rows = tbody.getElements('tr');
var rows = tbody.find('tr');
var emptyRows = [];
/* do we have empty rows? */
for (var i = 0; i < rows.length; i++) {
// var af = rows[i].getElement('.attach-field');
var af = $(rows[i]).find('.attach-field')[0];
if (af && !(af.files.length > 0)) {
emptyRows.push(af);
break; /* one is enough, so we can break */
}
}
/* if not create one */
if (emptyRows.length < 1) {
var row = $(rows[rows.length - 1]).clone();
// row.getElement('.attach-field').on('change', addattach).value = '';
// row.getElement('.clear-attach-field').on('click', clearattach).value = '';
row.find('.attach-field').on('change', addattach).val('');
row.find('.clear-attach-field').on('click', clearattach).val('');
// row.inject(tbody);
tbody.append(row);
}
}
function clearattach(event) {
var event = event || window.event;
// var grandpa = $(event.target).getParent().getParent();
var grandpa = $(this).parent().parent();
// var af = grandpa.getElement('.attach-field');
var af = grandpa.find('.attach-field')[0];
if (af) af.value = '';
// var an = grandpa.getElement('.attach-name');
var an = grandpa.find('.attach-name')[0];
if (an) an.value = '';
// var ad = grandpa.getElement('.attach-desc');
var ad = grandpa.find('.attach-desc')[0];
if (ad) ad.value = '';
}

View File

@ -0,0 +1,66 @@
// window.addEvent('domready', function() {
jQuery(document).ready(function ($) {
/* categories filtering */
$('.eventCat').each(
function (index, item) {
$(item).on('click', function () {
$('.jlcalendar .' + $(item).attr('id')).each(
function (index, eventcat) {
eventcat = $(eventcat);
if (eventcat.css('display') == 'none') {
eventcat.css('display', 'block');
$(item).removeClass('catoff');
} else {
eventcat.css('display', 'none');
$(item).addClass('catoff');
}
}
);
});
}
);
/* Show all */
btn = $('#buttonshowall');
if (btn) {
btn.on('click', function () {
$('.jlcalendar .eventcontent').each(
function (index, eventcat) {
el = $(eventcat).find('div[class^=cat]');
el.css('display', 'block');
}
);
$('#jlcalendarlegend .eventCat').each(
function (index, eventcat) {
$(eventcat).removeClass('catoff');
}
);
});
}
/* Hide all */
btn = $('#buttonhideall');
if (btn) {
btn.on('click', function () {
$('.jlcalendar .eventcontent').each(
function (index, eventcat) {
el = $(eventcat).find('div[class^=cat]');
el.css('display', 'none');
}
);
$('#jlcalendarlegend .eventCat').each(
function (index, eventcat) {
$(eventcat).addClass('catoff');
}
);
});
}
var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl, {html: true})
})
});

View File

@ -0,0 +1,238 @@
/*
* Gchats color picker by Majid Khosravi
* Copyright (c) 2006 - 2008 Gchat Design Studio
* URL: https://www.gchats.com
* Last Updated: August 29 2009
* Gchats color picker is freely distributable under the terms of GPL license.
* Please visit: https://www.gchats.com for updates
* @Version 1.2
*
* The code in function testcolor is based upon:
* https://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx
*
*--------------------------------------------------------------------------*/
// JavaScript Document
var layerWidth = 218;
var layerHeight = 144;
var currentId = "";
var orgColor = "";
var onPick = "";
var onCancel = "";
function openPicker(id, _onPick, _onCancel) {
if (_onPick) {
onPick = _onPick;
}
if (_onCancel) {
onCancel = _onCancel;
}
currentId = id;
removeLayer("picker");
Obj = document.getElementById(id);
orgColor = Obj.value;
createLayer("picker", findPosX(Obj) + Obj.offsetWidth + 20, findPosY(Obj));
}
function createLayer(id, left, top) {
var width = layerWidth;
var height = layerHeight;
var zindex = 1000;
var bgcolor = "#d4d0c8";
var txtcolor = "#000000";
var msg = getPickerContent();
if (document.layers) {
if (document.layers[id]) {
return;
}
var layer = document.layers[id] = new Layer(width);
layer.className = "picker_layer";
layer.name = id;
layer.left = left;
layer.top = top;
layer.clip.height = height;
layer.visibility = 'show';
layer.zIndex = zindex;
layer.bgColor = bgcolor;
layer.innerHTML = msg;
} else if (document.all) {
if (document.all[id]) {
return
}
var layer = '\n<DIV class="picker_layer" id=' + id + ' style="position:absolute'
+ '; left:' + left + "px"
+ '; top:' + top + "px"
+ '; width:' + width
+ '; height:' + height
+ '; visibility:visible'
+ '; z-index:' + zindex
+ ';text-align:left">'
+ msg
+ '</DIV>';
document.body.insertAdjacentHTML("BeforeEnd", layer);
} else if (document.getElementById) {
var layer = document.createElement('div');
layer.setAttribute('id', id);
document.body.appendChild(layer);
var ly = document.getElementById(id);
ly.className = "picker_layer";
ly.style.position = "absolute";
ly.style.left = left + "px";
ly.style.top = top + "px";
ly.style.width = width + "px";
ly.style.height = height + "px";
ly.style.textAlign = "left";
ly.innerHTML = msg;
}
}
function showClr(color) {
Obj = document.getElementById(currentId);
Obj.value = color;
Obj.style.backgroundColor = color;
Obj = document.getElementById("gcpicker_colorSample");
Obj.style.backgroundColor = color;
Obj = document.getElementById("gcpicker_colorCode");
Obj.innerHTML = color;
}
function setClr(color) {
Obj = document.getElementById(currentId);
Obj.value = color;
Obj.style.backgroundColor = color;
currentId = "";
removeLayer("picker");
if (onPick) {
var fontcolor = testcolor(color);
Obj.style.color = fontcolor;
}
}
function cancel() {
Obj = document.getElementById(currentId);
Obj.value = orgColor;
Obj.style.backgroundColor = orgColor;
removeLayer("picker");
if (onCancel) {
}
}
function removeLayer(id) {
if (document.getElementById(id) == null) {
return;
}
if (document.layers && document.layers[id]) {
document.layers[id].visibility = 'hide';
delete document.layers[id];
}
if (document.all && document.all[id]) {
document.all[id].innerHTML = '';
document.all[id].outerHTML = '';
} else if (document.getElementById) {
var b = document.body;
var layer = document.getElementById(id);
b.removeChild(layer);
}
}
function getPickerContent() {
var content = '<table width="222" border="0" cellpadding="0" cellspacing="1"><tr><td>';
content += '<table width="100%" border="0" cellpadding="0" cellspacing="1" class="color_table"><tr><td bgcolor="' + orgColor + '" id="gcpicker_colorSample" width="40px" class="choosed_color_cell">&nbsp;</td><td align="center"><div id="gcpicker_colorCode">' + orgColor + '</div></td><td width="60px" align="center"><input type="submit" value="" onclick="cancel()" class="default_color_btn" /></td></tr></table>';
content += '</td></tr><tr><td>';
content += colorTable() + '</td></tr></table>';
return content;
}
function colorTable() {
var clrfix = Array("#000000", "#333333", "#666666", "#999999", "#cccccc", "#ffffff", "#ff0000", "#00ff00", "#0000ff", "#ffff00", "#00ffff", "#ff00ff");
var table = '<table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000"><tr>';
table += '';
for (var j = 0; j < 3; j++) {
table += '<td width="11"><table bgcolor="#000000" border="0" cellpadding="0" cellspacing="1" class="color_table">';
for (var i = 0; i < 12; i++) {
var clr = '#000000';
if (j == 1) {
clr = clrfix[i];
}
table += '<tr><td bgcolor="' + clr + '" class="cell_color" onmouseover="showClr(' + "'" + clr + "'" + ')" onclick="setClr(' + "'" + clr + "'" + ')"></td></tr>';
}
table += '</table></td>';
}
table += '<td><table border="0" cellpadding="0" cellspacing="0">';
for (var c = 0; c < 6; c++) {
if (c == 0 || c == 3) {
table += "<tr>";
}
table += "<td>";
table = table + '<table border="0" cellpadding="0" cellspacing="1" class="color_table"> ';
for (var j = 0; j < 6; j++) {
table += "<tr>";
for (var i = 0; i < 6; i++) {
var clrhex = rgb2hex(j * 255 / 5, i * 255 / 5, c * 255 / 5);
table += '<td bgcolor="' + clrhex + '" class="cell_color" onmouseover="showClr(' + "'" + clrhex + "'" + ')" onclick="setClr(' + "'" + clrhex + "'" + ')"></td>';
}
table += "</tr>";
}
table += "</table>";
table += "</td>";
if (c == 2 || c == 5) {
table += "</tr>";
}
}
table += '</table></td></tr></table>';
return table;
}
function findPosX(obj) {
var curleft = 0;
if (obj.offsetParent)
while (1) {
curleft += obj.offsetLeft;
if (!obj.offsetParent)
break;
obj = obj.offsetParent;
}
else if (obj.x)
curleft += obj.x;
return curleft;
}
function findPosY(obj) {
var curtop = 0;
if (obj.offsetParent) {
while (1) {
curtop += obj.offsetTop;
if (!obj.offsetParent) {
break;
}
obj = obj.offsetParent;
}
} else if (obj.y) {
curtop += obj.y;
}
return curtop;
}
function rgb2hex(red, green, blue) {
var decColor = red + 256 * green + 65536 * blue;
var clr = decColor.toString(16);
for (var i = clr.length; i < 6; i++) {
clr = "0" + clr;
}
return "#" + clr;
}
function testcolor(color) {
if (color.length == 7) {
color = color.substring(1);
}
var R = parseInt(color.substring(0, 2), 16);
var G = parseInt(color.substring(2, 4), 16);
var B = parseInt(color.substring(4, 6), 16);
var x = Math.sqrt(R * R * .299 + G * G * .587 + B * B * .114);
var sColorText = x < 130 ? '#FFFFFF' : '#000000';
return sColorText;
}

View File

@ -0,0 +1,146 @@
function initialize() {
/* coordinates */
var lat = document.getElementById('latitude').value;
var long = document.getElementById('longitude').value;
/* address */
var title = document.getElementById('venue').value;
var city = document.getElementById('city').value;
var postalCode = document.getElementById('postalCode').value;
var street = document.getElementById('street').value;
var myLatlng = new google.maps.LatLng(lat, long);
var myMapOptions = {
zoom: 16
, center: myLatlng
, mapTypeId: google.maps.MapTypeId.ROADMAP
, disableDefaultUI: false
};
var map = new google.maps.Map(document.getElementById('map-canvas'), myMapOptions);
// check for zero
if (lat == 0.000000) {
lat = null;
}
if (long == 0.000000) {
long = null;
}
/* check to see if we've lat+long
/* if we've it then we can use the coordinates to center the map
*/
if (lat && long) {
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: title,
visible: true,
icon: "https://chart.apis.google.com/chart?chst=d_map_pin_letter_withshadow&chld=•|FF0000|000000"
});
var boxText = document.createElement("div");
boxText.style.cssText = "border: 1px solid black; margin-top: 8px; background: yellow; padding: 5px;";
boxText.innerHTML = "<b>" + title + "</b><br>" + street + "<br>" + postalCode + "<br>" + city;
var myOptions = {
content: boxText
, disableAutoPan: false
, maxWidth: 0
, pixelOffset: new google.maps.Size(-140, -120)
, zIndex: null
, boxStyle: {
background: "url('tipbox.gif') no-repeat"
, opacity: 0.75
, width: "280px"
}
, closeBoxMargin: "10px 2px 2px 2px"
, closeBoxURL: "https://www.google.com/intl/en_us/mapfiles/close.gif"
, infoBoxClearance: new google.maps.Size(1, 1)
, isHidden: false
, pane: "floatPane"
, enableEventPropagation: false
};
google.maps.event.addListener(marker, "click", function (e) {
ib.open(map, this);
});
var ib = new InfoBox(myOptions);
// ib.open(map, marker); /* disabled infobox to popup at default */
} else {
geocoder = new google.maps.Geocoder();
var address = street + "," + postalCode + "," + city;
geocoder.geocode({'address': address}, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
// Geocoding-status is ok, but we want to retrieve an exact address
if (results[0].geometry.location_type) {
//In this case it creates a marker, but you can get the lat and lng from the location.LatLng
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
icon: "https://chart.apis.google.com/chart?chst=d_map_pin_letter_withshadow&chld=•|FF0000|000000"
});
var boxText = document.createElement("div");
boxText.style.cssText = "border: 1px solid black; margin-top: 8px; background: yellow; padding: 5px;";
boxText.innerHTML = "<b>" + title + "</b><br>" + street + "<br>" + postalCode + "<br>" + city;
var myOptions = {
content: boxText
, disableAutoPan: false
, maxWidth: 0
, pixelOffset: new google.maps.Size(-140, -120)
, zIndex: null
, boxStyle: {
background: "url('tipbox.gif') no-repeat"
, opacity: 0.75
, width: "280px"
}
, closeBoxMargin: "10px 2px 2px 2px"
, closeBoxURL: "https://www.google.com/intl/en_us/mapfiles/close.gif"
, infoBoxClearance: new google.maps.Size(1, 1)
, isHidden: false
, pane: "floatPane"
, enableEventPropagation: false
};
google.maps.event.addListener(marker, "click", function (e) {
ib.open(map, this);
});
var ib = new InfoBox(myOptions);
// ib.open(map, marker); /* disabled infobox to popup at default */
} else {
error();
}
} else {
/*alert("Geocode was not successful for the following reason: " + status);*/
error();
}
});
}
}
function error() {
/*var text = "<div style='text-align: center;'><h1 >Attention!</h1><p>no valid data to load the map</p></div>";*/
var text = "";
document.getElementById('map-canvas').innerHTML = text;
}
google.maps.event.addDomListener(window, 'load', initialize);

View File

@ -0,0 +1,203 @@
/*
highlight v4
Highlights arbitrary terms.
<https://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html>
MIT license.
Johann Burkard
<https://johannburkard.de>
<mailto:jb@eaio.com>
To highlight all occurrances of "bla" (case insensitive) in all li elements, use the following code:
$('li').highlight('bla');
Remove highlighting
The highlight can be removed from any element with the removeHighlight function.
In this example, all highlights under the element with the ID highlight-plugin are removed.
$('#highlight-plugin').removeHighlight();
*/
$.fn.highlight = function (pat) {
function innerHighlight(node, pat) {
var skip = 0;
if (node.nodeType == 3) {
var pos = node.data.toUpperCase().indexOf(pat);
if (pos >= 0) {
var spannode = document.createElement('span');
spannode.className = 'highlight';
var middlebit = node.splitText(pos);
var endbit = middlebit.splitText(pat.length);
var middleclone = middlebit.cloneNode(true);
spannode.appendChild(middleclone);
middlebit.parentNode.replaceChild(spannode, middlebit);
skip = 1;
}
} else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) {
for (var i = 0; i < node.childNodes.length; ++i) {
i += innerHighlight(node.childNodes[i], pat);
}
}
return skip;
}
return this.length && pat && pat.length ? this.each(function () {
innerHighlight(this, pat.toUpperCase());
}) : this;
};
$.fn.removeHighlight = function () {
return this.find("span.highlight").each(function () {
this.parentNode.firstChild.nodeName;
with (this.parentNode) {
replaceChild(this.firstChild, this);
normalize();
}
}).end();
};
function highlightevents() {
var searcharea = $("#search_in_here");
var filterOptionValue = $('select[name=filter_type]').val(); // value of selected option
var filterOptionText = $("#filter_type option:selected").text(); // text of selected option
var lowerCase = filterOptionText.toLowerCase();
switch (parseInt(filterOptionValue)) {
case 1:
var filter = 'eventtitle';
break;
case 2:
var filter = 'venue';
break;
case 3:
var filter = 'city';
break;
case 4:
var filter = 'category';
break;
case 5:
var filter = 'state';
break;
case 6:
var filter = 'country';
break;
case 7:
alleventfilters();
break;
default:
alleventfilters();
break;
}
var newtext = $("#filter_search").val();
var newtext2 = "td." + filter + ":contains(" + newtext + ")";
if (filter && newtext) {
searcharea.find(newtext2).addClass('red');
$(searcharea.find(newtext2)).highlight(newtext);
}
}
function alleventfilters() {
var searcharea = $("#search_in_here");
var keyword = $("#filter_search").val();
var title = 'eventtitle';
var venue = 'venue';
var city = 'city';
var state = 'state';
var country = 'country';
var category = 'category';
if (keyword) {
var titleparameter = "td." + title + ":contains(" + keyword + ")";
searcharea.find(titleparameter).addClass('red');
$(searcharea.find(titleparameter)).highlight(keyword);
var venueparameter = "td." + venue + ":contains(" + keyword + ")";
searcharea.find(venueparameter).addClass('red');
$(searcharea.find(venueparameter)).highlight(keyword);
var cityparameter = "td." + city + ":contains(" + keyword + ")";
searcharea.find(cityparameter).addClass('red');
$(searcharea.find(cityparameter)).highlight(keyword);
var stateparameter = "td." + state + ":contains(" + keyword + ")";
searcharea.find(stateparameter).addClass('red');
$(searcharea.find(stateparameter)).highlight(keyword);
var countryparameter = "td." + country + ":contains(" + keyword + ")";
searcharea.find(countryparameter).addClass('red');
$(searcharea.find(countryparameter)).highlight(keyword);
var categoryparameter = "td." + category + ":contains(" + keyword + ")";
searcharea.find(categoryparameter).addClass('red');
$(searcharea.find(categoryparameter)).highlight(keyword);
}
}
function highlightvenues() {
var searcharea = $("#search_in_here");
var filterOptionValue = $('select[name=filter_type]').val(); // value of selected option
var filterOptionText = $("#filter_type option:selected").text(); // text of selected option
var lowerCase = filterOptionText.toLowerCase();
switch (parseInt(filterOptionValue)) {
case 1:
var filter = 'venue';
break;
case 2:
var filter = 'city';
break;
case 3:
var filter = 'state';
break;
case 4:
var filter = 'country';
break;
case 5:
allvenuefilters();
break;
default:
allvenuefilters();
break;
}
var newtext = $("#filter_search").val();
var newtext2 = "td." + filter + ":contains(" + newtext + ")";
if (filter && newtext) {
searcharea.find(newtext2).addClass('red');
$(searcharea.find(newtext2)).highlight(newtext);
}
}
function allvenuefilters() {
var searcharea = $("#search_in_here");
var keyword = $("#filter_search").val();
var title = 'venue';
var city = 'city';
var state = 'state';
var country = 'country';
if (keyword) {
var titleparameter = "td." + title + ":contains(" + keyword + ")";
searcharea.find(titleparameter).addClass('red');
$(searcharea.find(titleparameter)).highlight(keyword);
var cityparameter = "td." + city + ":contains(" + keyword + ")";
searcharea.find(cityparameter).addClass('red');
$(searcharea.find(cityparameter)).highlight(keyword);
var stateparameter = "td." + state + ":contains(" + keyword + ")";
searcharea.find(stateparameter).addClass('red');
$(searcharea.find(stateparameter)).highlight(keyword);
var countryparameter = "td." + country + ":contains(" + keyword + ")";
searcharea.find(countryparameter).addClass('red');
$(searcharea.find(countryparameter)).highlight(keyword);
}
}

View File

@ -0,0 +1 @@
<!DOCTYPE html><title></title>

819
media/com_jem/js/infobox.js Normal file
View File

@ -0,0 +1,819 @@
/**
* @name InfoBox
* @version 1.1.13 [March 19, 2014]
* @author Gary Little (inspired by proof-of-concept code from Pamela Fox of Google)
* @copyright Copyright 2010 Gary Little [gary at luxcentral.com]
* @fileoverview InfoBox extends the Google Maps JavaScript API V3 <tt>OverlayView</tt> class.
* <p>
* An InfoBox behaves like a <tt>google.maps.InfoWindow</tt>, but it supports several
* additional properties for advanced styling. An InfoBox can also be used as a map label.
* <p>
* An InfoBox also fires the same events as a <tt>google.maps.InfoWindow</tt>.
*
* @source link: https://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/examples/infobox-basic.html
*/
/*!
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*jslint browser:true */
/*global google */
/**
* @name InfoBoxOptions
* @class This class represents the optional parameter passed to the {@link InfoBox} constructor.
* @property {string|Node} content The content of the InfoBox (plain text or an HTML DOM node).
* @property {boolean} [disableAutoPan=false] Disable auto-pan on <tt>open</tt>.
* @property {number} maxWidth The maximum width (in pixels) of the InfoBox. Set to 0 if no maximum.
* @property {Size} pixelOffset The offset (in pixels) from the top left corner of the InfoBox
* (or the bottom left corner if the <code>alignBottom</code> property is <code>true</code>)
* to the map pixel corresponding to <tt>position</tt>.
* @property {LatLng} position The geographic location at which to display the InfoBox.
* @property {number} zIndex The CSS z-index style value for the InfoBox.
* Note: This value overrides a zIndex setting specified in the <tt>boxStyle</tt> property.
* @property {string} [boxClass="infoBox"] The name of the CSS class defining the styles for the InfoBox container.
* @property {Object} [boxStyle] An object literal whose properties define specific CSS
* style values to be applied to the InfoBox. Style values defined here override those that may
* be defined in the <code>boxClass</code> style sheet. If this property is changed after the
* InfoBox has been created, all previously set styles (except those defined in the style sheet)
* are removed from the InfoBox before the new style values are applied.
* @property {string} closeBoxMargin The CSS margin style value for the close box.
* The default is "2px" (a 2-pixel margin on all sides).
* @property {string} closeBoxURL The URL of the image representing the close box.
* Note: The default is the URL for Google's standard close box.
* Set this property to "" if no close box is required.
* @property {Size} infoBoxClearance Minimum offset (in pixels) from the InfoBox to the
* map edge after an auto-pan.
* @property {boolean} [isHidden=false] Hide the InfoBox on <tt>open</tt>.
* [Deprecated in favor of the <tt>visible</tt> property.]
* @property {boolean} [visible=true] Show the InfoBox on <tt>open</tt>.
* @property {boolean} alignBottom Align the bottom left corner of the InfoBox to the <code>position</code>
* location (default is <tt>false</tt> which means that the top left corner of the InfoBox is aligned).
* @property {string} pane The pane where the InfoBox is to appear (default is "floatPane").
* Set the pane to "mapPane" if the InfoBox is being used as a map label.
* Valid pane names are the property names for the <tt>google.maps.MapPanes</tt> object.
* @property {boolean} enableEventPropagation Propagate mousedown, mousemove, mouseover, mouseout,
* mouseup, click, dblclick, touchstart, touchend, touchmove, and contextmenu events in the InfoBox
* (default is <tt>false</tt> to mimic the behavior of a <tt>google.maps.InfoWindow</tt>). Set
* this property to <tt>true</tt> if the InfoBox is being used as a map label.
*/
/**
* Creates an InfoBox with the options specified in {@link InfoBoxOptions}.
* Call <tt>InfoBox.open</tt> to add the box to the map.
* @constructor
* @param {InfoBoxOptions} [opt_opts]
*/
function InfoBox(opt_opts) {
opt_opts = opt_opts || {};
google.maps.OverlayView.apply(this, arguments);
// Standard options (in common with google.maps.InfoWindow):
//
this.content_ = opt_opts.content || "";
this.disableAutoPan_ = opt_opts.disableAutoPan || false;
this.maxWidth_ = opt_opts.maxWidth || 0;
this.pixelOffset_ = opt_opts.pixelOffset || new google.maps.Size(0, 0);
this.position_ = opt_opts.position || new google.maps.LatLng(0, 0);
this.zIndex_ = opt_opts.zIndex || null;
// Additional options (unique to InfoBox):
//
this.boxClass_ = opt_opts.boxClass || "infoBox";
this.boxStyle_ = opt_opts.boxStyle || {};
this.closeBoxMargin_ = opt_opts.closeBoxMargin || "2px";
this.closeBoxURL_ = opt_opts.closeBoxURL || "https://www.google.com/intl/en_us/mapfiles/close.gif";
if (opt_opts.closeBoxURL === "") {
this.closeBoxURL_ = "";
}
this.infoBoxClearance_ = opt_opts.infoBoxClearance || new google.maps.Size(1, 1);
if (typeof opt_opts.visible === "undefined") {
if (typeof opt_opts.isHidden === "undefined") {
opt_opts.visible = true;
} else {
opt_opts.visible = !opt_opts.isHidden;
}
}
this.isHidden_ = !opt_opts.visible;
this.alignBottom_ = opt_opts.alignBottom || false;
this.pane_ = opt_opts.pane || "floatPane";
this.enableEventPropagation_ = opt_opts.enableEventPropagation || false;
this.div_ = null;
this.closeListener_ = null;
this.moveListener_ = null;
this.contextListener_ = null;
this.eventListeners_ = null;
this.fixedWidthSet_ = null;
}
/* InfoBox extends OverlayView in the Google Maps API v3.
*/
InfoBox.prototype = new google.maps.OverlayView();
/**
* Creates the DIV representing the InfoBox.
* @private
*/
InfoBox.prototype.createInfoBoxDiv_ = function () {
var i;
var events;
var bw;
var me = this;
// This handler prevents an event in the InfoBox from being passed on to the map.
//
var cancelHandler = function (e) {
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
};
// This handler ignores the current event in the InfoBox and conditionally prevents
// the event from being passed on to the map. It is used for the contextmenu event.
//
var ignoreHandler = function (e) {
e.returnValue = false;
if (e.preventDefault) {
e.preventDefault();
}
if (!me.enableEventPropagation_) {
cancelHandler(e);
}
};
if (!this.div_) {
this.div_ = document.createElement("div");
this.setBoxStyle_();
if (typeof this.content_.nodeType === "undefined") {
this.div_.innerHTML = this.getCloseBoxImg_() + this.content_;
} else {
this.div_.innerHTML = this.getCloseBoxImg_();
this.div_.appendChild(this.content_);
}
// Add the InfoBox DIV to the DOM
this.getPanes()[this.pane_].appendChild(this.div_);
this.addClickHandler_();
if (this.div_.style.width) {
this.fixedWidthSet_ = true;
} else {
if (this.maxWidth_ !== 0 && this.div_.offsetWidth > this.maxWidth_) {
this.div_.style.width = this.maxWidth_;
this.div_.style.overflow = "auto";
this.fixedWidthSet_ = true;
} else { // The following code is needed to overcome problems with MSIE
bw = this.getBoxWidths_();
this.div_.style.width = (this.div_.offsetWidth - bw.left - bw.right) + "px";
this.fixedWidthSet_ = false;
}
}
this.panBox_(this.disableAutoPan_);
if (!this.enableEventPropagation_) {
this.eventListeners_ = [];
// Cancel event propagation.
//
// Note: mousemove not included (to resolve Issue 152)
events = ["mousedown", "mouseover", "mouseout", "mouseup",
"click", "dblclick", "touchstart", "touchend", "touchmove"];
for (i = 0; i < events.length; i++) {
this.eventListeners_.push(google.maps.event.addDomListener(this.div_, events[i], cancelHandler));
}
// Workaround for Google bug that causes the cursor to change to a pointer
// when the mouse moves over a marker underneath InfoBox.
this.eventListeners_.push(google.maps.event.addDomListener(this.div_, "mouseover", function (e) {
this.style.cursor = "default";
}));
}
this.contextListener_ = google.maps.event.addDomListener(this.div_, "contextmenu", ignoreHandler);
/**
* This event is fired when the DIV containing the InfoBox's content is attached to the DOM.
* @name InfoBox#domready
* @event
*/
google.maps.event.trigger(this, "domready");
}
};
/**
* Returns the HTML <IMG> tag for the close box.
* @private
*/
InfoBox.prototype.getCloseBoxImg_ = function () {
var img = "";
if (this.closeBoxURL_ !== "") {
img = "<img";
img += " src='" + this.closeBoxURL_ + "'";
img += " align=right"; // Do this because Opera chokes on style='float: right;'
img += " style='";
img += " position: relative;"; // Required by MSIE
img += " cursor: pointer;";
img += " margin: " + this.closeBoxMargin_ + ";";
img += "'>";
}
return img;
};
/**
* Adds the click handler to the InfoBox close box.
* @private
*/
InfoBox.prototype.addClickHandler_ = function () {
var closeBox;
if (this.closeBoxURL_ !== "") {
closeBox = this.div_.firstChild;
this.closeListener_ = google.maps.event.addDomListener(closeBox, "click", this.getCloseClickHandler_());
} else {
this.closeListener_ = null;
}
};
/**
* Returns the function to call when the user clicks the close box of an InfoBox.
* @private
*/
InfoBox.prototype.getCloseClickHandler_ = function () {
var me = this;
return function (e) {
// 1.0.3 fix: Always prevent propagation of a close box click to the map:
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
/**
* This event is fired when the InfoBox's close box is clicked.
* @name InfoBox#closeclick
* @event
*/
google.maps.event.trigger(me, "closeclick");
me.close();
};
};
/**
* Pans the map so that the InfoBox appears entirely within the map's visible area.
* @private
*/
InfoBox.prototype.panBox_ = function (disablePan) {
var map;
var bounds;
var xOffset = 0, yOffset = 0;
if (!disablePan) {
map = this.getMap();
if (map instanceof google.maps.Map) { // Only pan if attached to map, not panorama
if (!map.getBounds().contains(this.position_)) {
// Marker not in visible area of map, so set center
// of map to the marker position first.
map.setCenter(this.position_);
}
bounds = map.getBounds();
var mapDiv = map.getDiv();
var mapWidth = mapDiv.offsetWidth;
var mapHeight = mapDiv.offsetHeight;
var iwOffsetX = this.pixelOffset_.width;
var iwOffsetY = this.pixelOffset_.height;
var iwWidth = this.div_.offsetWidth;
var iwHeight = this.div_.offsetHeight;
var padX = this.infoBoxClearance_.width;
var padY = this.infoBoxClearance_.height;
var pixPosition = this.getProjection().fromLatLngToContainerPixel(this.position_);
if (pixPosition.x < (-iwOffsetX + padX)) {
xOffset = pixPosition.x + iwOffsetX - padX;
} else if ((pixPosition.x + iwWidth + iwOffsetX + padX) > mapWidth) {
xOffset = pixPosition.x + iwWidth + iwOffsetX + padX - mapWidth;
}
if (this.alignBottom_) {
if (pixPosition.y < (-iwOffsetY + padY + iwHeight)) {
yOffset = pixPosition.y + iwOffsetY - padY - iwHeight;
} else if ((pixPosition.y + iwOffsetY + padY) > mapHeight) {
yOffset = pixPosition.y + iwOffsetY + padY - mapHeight;
}
} else {
if (pixPosition.y < (-iwOffsetY + padY)) {
yOffset = pixPosition.y + iwOffsetY - padY;
} else if ((pixPosition.y + iwHeight + iwOffsetY + padY) > mapHeight) {
yOffset = pixPosition.y + iwHeight + iwOffsetY + padY - mapHeight;
}
}
if (!(xOffset === 0 && yOffset === 0)) {
// Move the map to the shifted center.
//
var c = map.getCenter();
map.panBy(xOffset, yOffset);
}
}
}
};
/**
* Sets the style of the InfoBox by setting the style sheet and applying
* other specific styles requested.
* @private
*/
InfoBox.prototype.setBoxStyle_ = function () {
var i, boxStyle;
if (this.div_) {
// Apply style values from the style sheet defined in the boxClass parameter:
this.div_.className = this.boxClass_;
// Clear existing inline style values:
this.div_.style.cssText = "";
// Apply style values defined in the boxStyle parameter:
boxStyle = this.boxStyle_;
for (i in boxStyle) {
if (boxStyle.hasOwnProperty(i)) {
this.div_.style[i] = boxStyle[i];
}
}
// Fix for iOS disappearing InfoBox problem.
// See https://stackoverflow.com/questions/9229535/google-maps-markers-disappear-at-certain-zoom-level-only-on-iphone-ipad
this.div_.style.WebkitTransform = "translateZ(0)";
// Fix up opacity style for benefit of MSIE:
//
if (typeof this.div_.style.opacity !== "undefined" && this.div_.style.opacity !== "") {
// See https://www.quirksmode.org/css/opacity.html
this.div_.style.MsFilter = "\"progid:DXImageTransform.Microsoft.Alpha(Opacity=" + (this.div_.style.opacity * 100) + ")\"";
this.div_.style.filter = "alpha(opacity=" + (this.div_.style.opacity * 100) + ")";
}
// Apply required styles:
//
this.div_.style.position = "absolute";
this.div_.style.visibility = 'hidden';
if (this.zIndex_ !== null) {
this.div_.style.zIndex = this.zIndex_;
}
}
};
/**
* Get the widths of the borders of the InfoBox.
* @private
* @return {Object} widths object (top, bottom left, right)
*/
InfoBox.prototype.getBoxWidths_ = function () {
var computedStyle;
var bw = {top: 0, bottom: 0, left: 0, right: 0};
var box = this.div_;
if (document.defaultView && document.defaultView.getComputedStyle) {
computedStyle = box.ownerDocument.defaultView.getComputedStyle(box, "");
if (computedStyle) {
// The computed styles are always in pixel units (good!)
bw.top = parseInt(computedStyle.borderTopWidth, 10) || 0;
bw.bottom = parseInt(computedStyle.borderBottomWidth, 10) || 0;
bw.left = parseInt(computedStyle.borderLeftWidth, 10) || 0;
bw.right = parseInt(computedStyle.borderRightWidth, 10) || 0;
}
} else if (document.documentElement.currentStyle) { // MSIE
if (box.currentStyle) {
// The current styles may not be in pixel units, but assume they are (bad!)
bw.top = parseInt(box.currentStyle.borderTopWidth, 10) || 0;
bw.bottom = parseInt(box.currentStyle.borderBottomWidth, 10) || 0;
bw.left = parseInt(box.currentStyle.borderLeftWidth, 10) || 0;
bw.right = parseInt(box.currentStyle.borderRightWidth, 10) || 0;
}
}
return bw;
};
/**
* Invoked when <tt>close</tt> is called. Do not call it directly.
*/
InfoBox.prototype.onRemove = function () {
if (this.div_) {
this.div_.parentNode.removeChild(this.div_);
this.div_ = null;
}
};
/**
* Draws the InfoBox based on the current map projection and zoom level.
*/
InfoBox.prototype.draw = function () {
this.createInfoBoxDiv_();
var pixPosition = this.getProjection().fromLatLngToDivPixel(this.position_);
this.div_.style.left = (pixPosition.x + this.pixelOffset_.width) + "px";
if (this.alignBottom_) {
this.div_.style.bottom = -(pixPosition.y + this.pixelOffset_.height) + "px";
} else {
this.div_.style.top = (pixPosition.y + this.pixelOffset_.height) + "px";
}
if (this.isHidden_) {
this.div_.style.visibility = "hidden";
} else {
this.div_.style.visibility = "visible";
}
};
/**
* Sets the options for the InfoBox. Note that changes to the <tt>maxWidth</tt>,
* <tt>closeBoxMargin</tt>, <tt>closeBoxURL</tt>, and <tt>enableEventPropagation</tt>
* properties have no affect until the current InfoBox is <tt>close</tt>d and a new one
* is <tt>open</tt>ed.
* @param {InfoBoxOptions} opt_opts
*/
InfoBox.prototype.setOptions = function (opt_opts) {
if (typeof opt_opts.boxClass !== "undefined") { // Must be first
this.boxClass_ = opt_opts.boxClass;
this.setBoxStyle_();
}
if (typeof opt_opts.boxStyle !== "undefined") { // Must be second
this.boxStyle_ = opt_opts.boxStyle;
this.setBoxStyle_();
}
if (typeof opt_opts.content !== "undefined") {
this.setContent(opt_opts.content);
}
if (typeof opt_opts.disableAutoPan !== "undefined") {
this.disableAutoPan_ = opt_opts.disableAutoPan;
}
if (typeof opt_opts.maxWidth !== "undefined") {
this.maxWidth_ = opt_opts.maxWidth;
}
if (typeof opt_opts.pixelOffset !== "undefined") {
this.pixelOffset_ = opt_opts.pixelOffset;
}
if (typeof opt_opts.alignBottom !== "undefined") {
this.alignBottom_ = opt_opts.alignBottom;
}
if (typeof opt_opts.position !== "undefined") {
this.setPosition(opt_opts.position);
}
if (typeof opt_opts.zIndex !== "undefined") {
this.setZIndex(opt_opts.zIndex);
}
if (typeof opt_opts.closeBoxMargin !== "undefined") {
this.closeBoxMargin_ = opt_opts.closeBoxMargin;
}
if (typeof opt_opts.closeBoxURL !== "undefined") {
this.closeBoxURL_ = opt_opts.closeBoxURL;
}
if (typeof opt_opts.infoBoxClearance !== "undefined") {
this.infoBoxClearance_ = opt_opts.infoBoxClearance;
}
if (typeof opt_opts.isHidden !== "undefined") {
this.isHidden_ = opt_opts.isHidden;
}
if (typeof opt_opts.visible !== "undefined") {
this.isHidden_ = !opt_opts.visible;
}
if (typeof opt_opts.enableEventPropagation !== "undefined") {
this.enableEventPropagation_ = opt_opts.enableEventPropagation;
}
if (this.div_) {
this.draw();
}
};
/**
* Sets the content of the InfoBox.
* The content can be plain text or an HTML DOM node.
* @param {string|Node} content
*/
InfoBox.prototype.setContent = function (content) {
this.content_ = content;
if (this.div_) {
if (this.closeListener_) {
google.maps.event.removeListener(this.closeListener_);
this.closeListener_ = null;
}
// Odd code required to make things work with MSIE.
//
if (!this.fixedWidthSet_) {
this.div_.style.width = "";
}
if (typeof content.nodeType === "undefined") {
this.div_.innerHTML = this.getCloseBoxImg_() + content;
} else {
this.div_.innerHTML = this.getCloseBoxImg_();
this.div_.appendChild(content);
}
// Perverse code required to make things work with MSIE.
// (Ensures the close box does, in fact, float to the right.)
//
if (!this.fixedWidthSet_) {
this.div_.style.width = this.div_.offsetWidth + "px";
if (typeof content.nodeType === "undefined") {
this.div_.innerHTML = this.getCloseBoxImg_() + content;
} else {
this.div_.innerHTML = this.getCloseBoxImg_();
this.div_.appendChild(content);
}
}
this.addClickHandler_();
}
/**
* This event is fired when the content of the InfoBox changes.
* @name InfoBox#content_changed
* @event
*/
google.maps.event.trigger(this, "content_changed");
};
/**
* Sets the geographic location of the InfoBox.
* @param {LatLng} latlng
*/
InfoBox.prototype.setPosition = function (latlng) {
this.position_ = latlng;
if (this.div_) {
this.draw();
}
/**
* This event is fired when the position of the InfoBox changes.
* @name InfoBox#position_changed
* @event
*/
google.maps.event.trigger(this, "position_changed");
};
/**
* Sets the zIndex style for the InfoBox.
* @param {number} index
*/
InfoBox.prototype.setZIndex = function (index) {
this.zIndex_ = index;
if (this.div_) {
this.div_.style.zIndex = index;
}
/**
* This event is fired when the zIndex of the InfoBox changes.
* @name InfoBox#zindex_changed
* @event
*/
google.maps.event.trigger(this, "zindex_changed");
};
/**
* Sets the visibility of the InfoBox.
* @param {boolean} isVisible
*/
InfoBox.prototype.setVisible = function (isVisible) {
this.isHidden_ = !isVisible;
if (this.div_) {
this.div_.style.visibility = (this.isHidden_ ? "hidden" : "visible");
}
};
/**
* Returns the content of the InfoBox.
* @returns {string}
*/
InfoBox.prototype.getContent = function () {
return this.content_;
};
/**
* Returns the geographic location of the InfoBox.
* @returns {LatLng}
*/
InfoBox.prototype.getPosition = function () {
return this.position_;
};
/**
* Returns the zIndex for the InfoBox.
* @returns {number}
*/
InfoBox.prototype.getZIndex = function () {
return this.zIndex_;
};
/**
* Returns a flag indicating whether the InfoBox is visible.
* @returns {boolean}
*/
InfoBox.prototype.getVisible = function () {
var isVisible;
if ((typeof this.getMap() === "undefined") || (this.getMap() === null)) {
isVisible = false;
} else {
isVisible = !this.isHidden_;
}
return isVisible;
};
/**
* Shows the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.]
*/
InfoBox.prototype.show = function () {
this.isHidden_ = false;
if (this.div_) {
this.div_.style.visibility = "visible";
}
};
/**
* Hides the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.]
*/
InfoBox.prototype.hide = function () {
this.isHidden_ = true;
if (this.div_) {
this.div_.style.visibility = "hidden";
}
};
/**
* Adds the InfoBox to the specified map or Street View panorama. If <tt>anchor</tt>
* (usually a <tt>google.maps.Marker</tt>) is specified, the position
* of the InfoBox is set to the position of the <tt>anchor</tt>. If the
* anchor is dragged to a new location, the InfoBox moves as well.
* @param {Map|StreetViewPanorama} map
* @param {MVCObject} [anchor]
*/
InfoBox.prototype.open = function (map, anchor) {
var me = this;
if (anchor) {
this.position_ = anchor.getPosition();
this.moveListener_ = google.maps.event.addListener(anchor, "position_changed", function () {
me.setPosition(this.getPosition());
});
}
this.setMap(map);
if (this.div_) {
this.panBox_();
}
};
/**
* Removes the InfoBox from the map.
*/
InfoBox.prototype.close = function () {
var i;
if (this.closeListener_) {
google.maps.event.removeListener(this.closeListener_);
this.closeListener_ = null;
}
if (this.eventListeners_) {
for (i = 0; i < this.eventListeners_.length; i++) {
google.maps.event.removeListener(this.eventListeners_[i]);
}
this.eventListeners_ = null;
}
if (this.moveListener_) {
google.maps.event.removeListener(this.moveListener_);
this.moveListener_ = null;
}
if (this.contextListener_) {
google.maps.event.removeListener(this.contextListener_);
this.contextListener_ = null;
}
this.setMap(null);
};

View File

@ -0,0 +1,615 @@
/**
* jQuery Geocoding and Places Autocomplete Plugin - V 1.7.0
*
* @author Martin Kleppe <kleppe@ubilabs.net>, 2016
* @author Ubilabs https://ubilabs.net, 2016
* @license MIT License <https://www.opensource.org/licenses/mit-license.php>
*/
// # $.geocomplete()
// ## jQuery Geocoding and Places Autocomplete Plugin
//
// * https://github.com/ubilabs/geocomplete/
// * by Martin Kleppe <kleppe@ubilabs.net>
(function ($, window, document, undefined) {
// ## Options
// The default options for this plugin.
//
// * `map` - Might be a selector, an jQuery object or a DOM element. Default is `false` which shows no map.
// * `details` - The container that should be populated with data. Defaults to `false` which ignores the setting.
// * 'detailsScope' - Allows you to scope the 'details' container and have multiple geocomplete fields on one page. Must be a parent of the input. Default is 'null'
// * `location` - Location to initialize the map on. Might be an address `string` or an `array` with [latitude, longitude] or a `google.maps.LatLng`object. Default is `false` which shows a blank map.
// * `bounds` - Whether to snap geocode search to map bounds. Default: `true` if false search globally. Alternatively pass a custom `LatLngBounds object.
// * `autoselect` - Automatically selects the highlighted item or the first item from the suggestions list on Enter.
// * `detailsAttribute` - The attribute's name to use as an indicator. Default: `"name"`
// * `mapOptions` - Options to pass to the `google.maps.Map` constructor. See the full list [here](https://code.google.com/apis/maps/documentation/javascript/reference.html#MapOptions).
// * `mapOptions.zoom` - The inital zoom level. Default: `14`
// * `mapOptions.scrollwheel` - Whether to enable the scrollwheel to zoom the map. Default: `false`
// * `mapOptions.mapTypeId` - The map type. Default: `"roadmap"`
// * `markerOptions` - The options to pass to the `google.maps.Marker` constructor. See the full list [here](https://code.google.com/apis/maps/documentation/javascript/reference.html#MarkerOptions).
// * `markerOptions.draggable` - If the marker is draggable. Default: `false`. Set to true to enable dragging.
// * `markerOptions.disabled` - Do not show marker. Default: `false`. Set to true to disable marker.
// * `maxZoom` - The maximum zoom level too zoom in after a geocoding response. Default: `16`
// * `types` - An array containing one or more of the supported types for the places request. Default: `['geocode']` See the full list [here](https://code.google.com/apis/maps/documentation/javascript/places.html#place_search_requests).
// * `blur` - Trigger geocode when input loses focus.
// * `geocodeAfterResult` - If blur is set to true, choose whether to geocode if user has explicitly selected a result before blur.
// * `restoreValueAfterBlur` - Restores the input's value upon blurring. Default is `false` which ignores the setting.
var defaults = {
bounds: true,
strictBounds: false,
country: null,
map: false,
details: false,
detailsAttribute: "name",
detailsScope: null,
autoselect: true,
location: false,
mapOptions: {
zoom: 14,
scrollwheel: false,
mapTypeId: "roadmap"
},
markerOptions: {
draggable: false
},
maxZoom: 16,
types: ['geocode'],
blur: false,
geocodeAfterResult: false,
restoreValueAfterBlur: false
};
// See: [Geocoding Types](https://developers.google.com/maps/documentation/geocoding/#Types)
// on Google Developers.
var componentTypes = ("street_address route intersection political " +
"country administrative_area_level_1 administrative_area_level_2 " +
"administrative_area_level_3 colloquial_area locality sublocality " +
"neighborhood premise subpremise postal_code natural_feature airport " +
"park point_of_interest post_box street_number floor room " +
"lat lng viewport location " +
"formatted_address location_type bounds").split(" ");
// See: [Places Details Responses](https://developers.google.com/maps/documentation/javascript/places#place_details_responses)
// on Google Developers.
var placesDetails = ("id place_id url website vicinity reference name rating " +
"international_phone_number icon formatted_phone_number").split(" ");
// The actual plugin constructor.
function GeoComplete(input, options) {
this.options = $.extend(true, {}, defaults, options);
// This is a fix to allow types:[] not to be overridden by defaults
// so search results includes everything
if (options && options.types) {
this.options.types = options.types;
}
this.input = input;
this.$input = $(input);
this._defaults = defaults;
this._name = 'geocomplete';
this.init();
}
// Initialize all parts of the plugin.
$.extend(GeoComplete.prototype, {
init: function () {
this.initMap();
this.initMarker();
this.initGeocoder();
this.initDetails();
this.initLocation();
},
// Initialize the map but only if the option `map` was set.
// This will create a `map` within the given container
// using the provided `mapOptions` or link to the existing map instance.
initMap: function () {
if (!this.options.map) {
return;
}
if (typeof this.options.map.setCenter == "function") {
this.map = this.options.map;
return;
}
this.map = new google.maps.Map(
$(this.options.map)[0],
this.options.mapOptions
);
// add click event listener on the map
google.maps.event.addListener(
this.map,
'click',
$.proxy(this.mapClicked, this)
);
// add dragend even listener on the map
google.maps.event.addListener(
this.map,
'dragend',
$.proxy(this.mapDragged, this)
);
// add idle even listener on the map
google.maps.event.addListener(
this.map,
'idle',
$.proxy(this.mapIdle, this)
);
google.maps.event.addListener(
this.map,
'zoom_changed',
$.proxy(this.mapZoomed, this)
);
},
// Add a marker with the provided `markerOptions` but only
// if the option was set. Additionally it listens for the `dragend` event
// to notify the plugin about changes.
initMarker: function () {
if (!this.map) {
return;
}
var options = $.extend(this.options.markerOptions, {map: this.map});
if (options.disabled) {
return;
}
this.marker = new google.maps.Marker(options);
google.maps.event.addListener(
this.marker,
'dragend',
$.proxy(this.markerDragged, this)
);
},
// Associate the input with the autocompleter and create a geocoder
// to fall back when the autocompleter does not return a value.
initGeocoder: function () {
// Indicates is user did select a result from the dropdown.
var selected = false;
var options = {
types: this.options.types,
bounds: this.options.bounds === true ? null : this.options.bounds,
componentRestrictions: this.options.componentRestrictions,
strictBounds: this.options.strictBounds
};
if (this.options.country) {
options.componentRestrictions = {country: this.options.country};
}
this.autocomplete = new google.maps.places.Autocomplete(
this.input, options
);
this.geocoder = new google.maps.Geocoder();
// Bind autocomplete to map bounds but only if there is a map
// and `options.bindToMap` is set to true.
if (this.map && this.options.bounds === true) {
this.autocomplete.bindTo('bounds', this.map);
}
// Watch `place_changed` events on the autocomplete input field.
google.maps.event.addListener(
this.autocomplete,
'place_changed',
$.proxy(this.placeChanged, this)
);
// Prevent parent form from being submitted if user hit enter.
this.$input.on('keypress.' + this._name, function (event) {
if (event.keyCode === 13) {
return false;
}
});
// Assume that if user types anything after having selected a result,
// the selected location is not valid any more.
if (this.options.geocodeAfterResult === true) {
this.$input.bind('keypress.' + this._name, $.proxy(function () {
if (event.keyCode != 9 && this.selected === true) {
this.selected = false;
}
}, this));
}
// Listen for "geocode" events and trigger find action.
this.$input.bind('geocode.' + this._name, $.proxy(function () {
this.find();
}, this));
// Saves the previous input value
this.$input.bind('geocode:result.' + this._name, $.proxy(function () {
this.lastInputVal = this.$input.val();
}, this));
// Trigger find action when input element is blurred out and user has
// not explicitly selected a result.
// (Useful for typing partial location and tabbing to the next field
// or clicking somewhere else.)
if (this.options.blur === true) {
this.$input.on('blur.' + this._name, $.proxy(function () {
if (this.options.geocodeAfterResult === true && this.selected === true) {
return;
}
if (this.options.restoreValueAfterBlur === true && this.selected === true) {
setTimeout($.proxy(this.restoreLastValue, this), 0);
} else {
this.find();
}
}, this));
}
},
// Prepare a given DOM structure to be populated when we got some data.
// This will cycle through the list of component types and map the
// corresponding elements.
initDetails: function () {
if (!this.options.details) {
return;
}
if (this.options.detailsScope) {
var $details = $(this.input).parents(this.options.detailsScope).find(this.options.details);
} else {
var $details = $(this.options.details);
}
var attribute = this.options.detailsAttribute,
details = {};
function setDetail(value) {
details[value] = $details.find("[" + attribute + "=" + value + "]");
}
$.each(componentTypes, function (index, key) {
setDetail(key);
setDetail(key + "_short");
});
$.each(placesDetails, function (index, key) {
setDetail(key);
});
this.$details = $details;
this.details = details;
},
// Set the initial location of the plugin if the `location` options was set.
// This method will care about converting the value into the right format.
initLocation: function () {
var location = this.options.location, latLng;
if (!location) {
return;
}
if (typeof location == 'string') {
this.find(location);
return;
}
if (location instanceof Array) {
latLng = new google.maps.LatLng(location[0], location[1]);
}
if (location instanceof google.maps.LatLng) {
latLng = location;
}
if (latLng) {
if (this.map) {
this.map.setCenter(latLng);
}
if (this.marker) {
this.marker.setPosition(latLng);
}
}
},
destroy: function () {
if (this.map) {
google.maps.event.clearInstanceListeners(this.map);
google.maps.event.clearInstanceListeners(this.marker);
}
this.autocomplete.unbindAll();
google.maps.event.clearInstanceListeners(this.autocomplete);
google.maps.event.clearInstanceListeners(this.input);
this.$input.removeData();
this.$input.off(this._name);
this.$input.unbind('.' + this._name);
},
// Look up a given address. If no `address` was specified it uses
// the current value of the input.
find: function (address) {
this.geocode({
address: address || this.$input.val()
});
},
// Requests details about a given location.
// Additionally it will bias the requests to the provided bounds.
geocode: function (request) {
// Don't geocode if the requested address is empty
if (!request.address) {
return;
}
if (this.options.bounds && !request.bounds) {
if (this.options.bounds === true) {
request.bounds = this.map && this.map.getBounds();
} else {
request.bounds = this.options.bounds;
}
}
if (this.options.country) {
request.region = this.options.country;
}
this.geocoder.geocode(request, $.proxy(this.handleGeocode, this));
},
// Get the selected result. If no result is selected on the list, then get
// the first result from the list.
selectFirstResult: function () {
//$(".pac-container").hide();
var selected = '';
// Check if any result is selected.
if ($(".pac-item-selected")[0]) {
selected = '-selected';
}
// Get the first suggestion's text.
var $span1 = $(".pac-container:visible .pac-item" + selected + ":first span:nth-child(2)").text();
var $span2 = $(".pac-container:visible .pac-item" + selected + ":first span:nth-child(3)").text();
// Adds the additional information, if available.
var firstResult = $span1;
if ($span2) {
firstResult += " - " + $span2;
}
this.$input.val(firstResult);
return firstResult;
},
// Restores the input value using the previous value if it exists
restoreLastValue: function () {
if (this.lastInputVal) {
this.$input.val(this.lastInputVal);
}
},
// Handles the geocode response. If more than one results was found
// it triggers the "geocode:multiple" events. If there was an error
// the "geocode:error" event is fired.
handleGeocode: function (results, status) {
if (status === google.maps.GeocoderStatus.OK) {
var result = results[0];
this.$input.val(result.formatted_address);
this.update(result);
if (results.length > 1) {
this.trigger("geocode:multiple", results);
}
} else {
this.trigger("geocode:error", status);
}
},
// Triggers a given `event` with optional `arguments` on the input.
trigger: function (event, argument) {
this.$input.trigger(event, [argument]);
},
// Set the map to a new center by passing a `geometry`.
// If the geometry has a viewport, the map zooms out to fit the bounds.
// Additionally it updates the marker position.
center: function (geometry) {
if (geometry.viewport) {
this.map.fitBounds(geometry.viewport);
if (this.map.getZoom() > this.options.maxZoom) {
this.map.setZoom(this.options.maxZoom);
}
} else {
this.map.setZoom(this.options.maxZoom);
this.map.setCenter(geometry.location);
}
if (this.marker) {
this.marker.setPosition(geometry.location);
this.marker.setAnimation(this.options.markerOptions.animation);
}
},
// Update the elements based on a single places or geocoding response
// and trigger the "geocode:result" event on the input.
update: function (result) {
if (this.map) {
this.center(result.geometry);
}
if (this.$details) {
this.fillDetails(result);
}
this.trigger("geocode:result", result);
},
// Populate the provided elements with new `result` data.
// This will lookup all elements that has an attribute with the given
// component type.
fillDetails: function (result) {
var data = {},
geometry = result.geometry,
viewport = geometry.viewport,
bounds = geometry.bounds;
// Create a simplified version of the address components.
$.each(result.address_components, function (index, object) {
var name = object.types[0];
$.each(object.types, function (index, name) {
data[name] = object.long_name;
data[name + "_short"] = object.short_name;
});
});
// Add properties of the places details.
$.each(placesDetails, function (index, key) {
data[key] = result[key];
});
// Add infos about the address and geometry.
$.extend(data, {
formatted_address: result.formatted_address,
location_type: geometry.location_type || "PLACES",
viewport: viewport,
bounds: bounds,
location: geometry.location,
lat: geometry.location.lat(),
lng: geometry.location.lng()
});
// Set the values for all details.
$.each(this.details, $.proxy(function (key, $detail) {
var value = data[key];
this.setDetail($detail, value);
}, this));
this.data = data;
},
// Assign a given `value` to a single `$element`.
// If the element is an input, the value is set, otherwise it updates
// the text content.
setDetail: function ($element, value) {
if (value === undefined) {
value = "";
} else if (typeof value.toUrlValue == "function") {
value = value.toUrlValue();
}
if ($element.is(":input")) {
$element.val(value);
} else {
$element.text(value);
}
},
// Fire the "geocode:dragged" event and pass the new position.
markerDragged: function (event) {
this.trigger("geocode:dragged", event.latLng);
},
mapClicked: function (event) {
this.trigger("geocode:click", event.latLng);
},
// Fire the "geocode:mapdragged" event and pass the current position of the map center.
mapDragged: function (event) {
this.trigger("geocode:mapdragged", this.map.getCenter());
},
// Fire the "geocode:idle" event and pass the current position of the map center.
mapIdle: function (event) {
this.trigger("geocode:idle", this.map.getCenter());
},
mapZoomed: function (event) {
this.trigger("geocode:zoom", this.map.getZoom());
},
// Restore the old position of the marker to the last knwon location.
resetMarker: function () {
this.marker.setPosition(this.data.location);
this.setDetail(this.details.lat, this.data.location.lat());
this.setDetail(this.details.lng, this.data.location.lng());
},
// Update the plugin after the user has selected an autocomplete entry.
// If the place has no geometry it passes it to the geocoder.
placeChanged: function () {
var place = this.autocomplete.getPlace();
this.selected = true;
if (!place.geometry) {
if (this.options.autoselect) {
// Automatically selects the highlighted item or the first item from the
// suggestions list.
var autoSelection = this.selectFirstResult();
this.find(autoSelection);
}
} else {
// Use the input text if it already gives geometry.
this.update(place);
}
}
});
// A plugin wrapper around the constructor.
// Pass `options` with all settings that are different from the default.
// The attribute is used to prevent multiple instantiations of the plugin.
$.fn.geocomplete = function (options) {
var attribute = 'plugin_geocomplete';
// If you call `.geocomplete()` with a string as the first parameter
// it returns the corresponding property or calls the method with the
// following arguments.
if (typeof options == "string") {
var instance = $(this).data(attribute) || $(this).geocomplete().data(attribute),
prop = instance[options];
if (typeof prop == "function") {
prop.apply(instance, Array.prototype.slice.call(arguments, 1));
return $(this);
} else {
if (arguments.length == 2) {
prop = arguments[1];
}
return prop;
}
} else {
return this.each(function () {
// Prevent against multiple instantiations.
var instance = $.data(this, attribute);
if (!instance) {
instance = new GeoComplete(this, options);
$.data(this, attribute, instance);
}
});
}
};
})(jQuery, window, document);

15
media/com_jem/js/lightbox.min.js vendored Normal file

File diff suppressed because one or more lines are too long

34
media/com_jem/js/other.js Normal file
View File

@ -0,0 +1,34 @@
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
/**
* this file manages the js script for adding/removing attachements in event
*/
// window.addEvent('domready', function() {
jQuery(document).ready(function ($) {
$('#userfile-remove').on('click', function (event) {
var di = document.getElementById('datimage');
if (di) {
di.style.display = 'none';
}
var li = document.getElementById('locimage');
if (li) {
li.style.display = 'none';
}
var ufr = document.getElementById('userfile-remove');
if (ufr) {
ufr.style.display = 'none';
}
var ri = document.getElementById('removeimage');
if (ri) {
ri.value = '1';
}
});
});

View File

@ -0,0 +1,197 @@
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
* @author Sascha Karnatz
*/
var $content; // the content object
var $select_value;
var $select_element;
function start_recurrencescript(el) {
//window.addEvent('domready', function() {
// $content = $("#recurrence_output"); // get the object (position) of the output
$content = document.getElementById('recurrence_output'); // get the object (position) of the output
// $select_element = $("#"+el);
$select_element = document.getElementById(el);
output_recurrencescript(); // start the output
$("#" + el).on('change', output_recurrencescript); // additional event handler
}
/**
* the output of the script (a part of them is included in
* this function)
*
* @access public
**/
function output_recurrencescript() {
var $select_value = $select_element.value; // the value of the select list
if ($select_value != 0) { // want the user a recurrence
// create an element by the generate_output function
// ** $select_output is an array of all sentences of each type **
var $element = generate_output($select_output[$select_value], $select_value);
$content.replaceChild($element, $content.firstChild); // include the element
set_parameter(); // set the new parameter
if (navigator.appName == "Microsoft Internet Explorer") { // the IE don't know some CSS - classes
document.getElementById("counter_row").style.display = "inline"; // show the counter for the IE
} else {
document.getElementById("counter_row").style.display = "table-row"; // show the counter for the normal browsers
}
} else {
document.getElementById("recurrence_number").value = 0; // set the parameter
$nothing = document.createElement("span"); // create a new "empty" element
$nothing.appendChild(document.createTextNode(""));
$content.replaceChild($nothing, $content.firstChild); // replace the old element by the new one
document.getElementById("counter_row").style.display = "none"; // hide the counter
}
}
/**
* use the sentences of each type and include selectlist into this phrases
*
* @var array select_output
* @var integer select_value
* @return object the generated span element
* @access public
**/
function generate_output($select_output, $select_value) {
var $output_array = $select_output.split("[placeholder]"); // split the output into two parts
var $span = document.createElement("span"); // create a new element
for ($i = 0; $i < $output_array.length; $i++) {
$weekday_array = $output_array[$i].split("[placeholder_weekday]"); // split by the weekday placeholder
if ($weekday_array.length > 1) { // is the weekday placeholder set?
for ($k = 0; $k < $weekday_array.length; $k++) {
$span.appendChild(document.createTextNode($weekday_array[$k])); // include the the text snippets into span - element
if ($k == 0) { // the first iteration get an extra weekday selectlist
$span.appendChild(generate_selectlist_weekday());
}
}
} else {
$span.appendChild(document.createTextNode($output_array[$i])); // include the text snippet
}
if ($i == 0) { // first iteration get an extra selectlist
$span.appendChild(generate_selectlist($select_value));
}
}
return $span;
}
/**
* this function generate the normal selectlist
*
* @var integer select_value
* @return object the generated selectlist
* @access public
**/
function generate_selectlist($select_value) {
var $selectlist = document.createElement("select"); // new select element
$selectlist.name = "recurrence_selectlist"; // add attributes
$selectlist.id = "recurrence_selectlist";
$selectlist.onchange = set_parameter;
switch ($select_value) {
case "1":
$limit = 30; // days (1 month)
break;
case "2":
$limit = 13; // weeks (1/4 year)
break;
case "3":
$limit = 18; // months (1'5 years)
break;
case "4":
$limit = 7; // weekdays (7 cases)
break;
case "5":
$limit = 12; // years ( 1 dozen years)
break;
default:
$limit =24; // orders (future, hours?)
break;
}
for ($j = 0; $j < $limit; $j++) {
var $option = document.createElement("option"); // create option element
var $valueSelected = parseInt(document.getElementById("recurrence_number").value);
var $valueSelected_saved = parseInt(document.getElementById("recurrence_number_saved").value);
if ($j == $valueSelected_saved - 1) { // the selected - attribute
$option.selected = true;
}
if (($j >= 5) && ($select_value ==4)) { // get the word for "last" and "before last" in the weekday section
var $name_value = "";
switch ($j) {
case 5:
$name_value = $last;
break;
case 6:
$name_value = $before_last;
break;
}
$option.appendChild(document.createTextNode($name_value)); // insert the name
$option.value = $j + 1; // and the value
} else {
$option.appendChild(document.createTextNode($j + 1)); // + 1 day because their is no recuring each "0" day
$option.value = $j + 1;
}
$selectlist.appendChild($option); // include the option - element into the select - element
}
return $selectlist;
}
/**
* this function generate the weekday selectlist
*
* @return object the generated weekday selectlist
* @access public
**/
function generate_selectlist_weekday() {
var $selectlist = document.createElement("select"); // the new selectlist
$selectlist.name = "recurrence_selectlist_weekday"; // add attributes
$selectlist.id = "recurrence_selectlist_weekday";
$selectlist.multiple = true;
$selectlist.size = 7;
var selected = document.getElementById("recurrence_byday").value.split(','); // array of selected values
for ($j = 0; $j < 7; $j++) { // the 7 days
var $option = document.createElement("option"); // create the option - elements
$option.value = $weekday[$j][0]; // add the value
$option.appendChild(document.createTextNode($weekday[$j][1])); // + 1 day because their is no recuring each "0" day
if (selected.includes($option.value)) { // the selected - attribute
$option.selected = true;
}
$selectlist.appendChild($option); // include the option - element into the select - element
}
$($selectlist).on('change', function () {
var result = '';
var isempty = true;
for (i = 0; i < this.length; i++) {
if (this.options[i].selected) {
if (isempty) {
isempty = false;
} else {
result += ',';
}
result += this.options[i].value
}
}
document.getElementById('recurrence_byday').value = result;
});
return $selectlist;
}
/**
* set the value of the hidden input tags
*
* @access public
**/
function set_parameter() {
// include the value into the recurrence_number input tag
document.getElementById("recurrence_number").value = document.getElementById("recurrence_selectlist").value;
}

View File

@ -0,0 +1,50 @@
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
* @author Sascha Karnatz
*/
// window.addEvent('domready', function(){
jQuery(document).ready(function ($) {
/*
$('filter_date').addEvent('change', function() {
this.form.submit();
});
*/
if ($('#filter_continent').length) {
$('#filter_continent').on('change', function () {
if ($('#filter_country').length) {
$('#filter_country').val('');
}
if ($('#filter_city').length) {
$('#filter_city').val('');
}
this.form.submit();
});
}
if ($('#filter_country').length) {
$('#filter_country').on('change', function () {
if ($('#filter_city').length) {
$('#filter_city').val('');
}
this.form.submit();
});
}
if ($('#filter_city').length) {
$('#filter_city').on('change', function () {
this.form.submit();
});
}
if ($('#filter_category').length) {
$('#filter_category').on('change', function () {
this.form.submit();
});
}
});

217
media/com_jem/js/seo.js Normal file
View File

@ -0,0 +1,217 @@
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
* @author Sascha Karnatz
*/
/**
* Comments in German
* Function: dieses Javascript ermoeglicht es automatisch die Metatags zu befuellen
*/
// Variablen werden als global definiert, da sie ueber mehrere Funktion hinweg genutzt werden
var $keyword; // Array - aufgeschlitete Variablen, welche einem HTML-Tag zugeordnet werden kann
var $keywords; // String - Verbindungsvariable zur noch nicht umgeschriebenen Variante der Keywords
var $manual_keywords = ""; // String - Speichert alle manuell eingefuegen Keywords ab
var $description; // String - die Beschreibung
var $description_vars; // Array - HTML - Tags, die mit einem onchange versehen werden
var $inputbox = ""; // String - es wird mit Hilfe dieser Variable ermittel, ob der User Beschreibung bzw. Keywords angeklickt hat
var $meta_error; // String - Fehler, der in der jeweiligen Sprache ausgegeben wird
function starter($msg) { // Funktion, welche beim Starten der Seite aufgerufen werden
get_keywords(); // leider funktionier window.onload nicht, da sonst die Popupfenster Fehler verursachen
get_description();
switchstart();
$meta_error = $msg;
}
function switchstart() { // Diese Funktion uebergibt alle relevanten Feldern ein onchange
try {
if ($keyword.length > 0) {
for (var i = 0; i < $keyword.length; i++) {
document.getElementById($keyword[i]).onchange = seo_switch;
}
}
if ($description_vars.length > 0) {
for (var i = 0; i < $description_vars.length; i++) {
document.getElementById($description_vars[i]).onchange = seo_switch;
}
}
} catch (e) {
//alert("Error occurred! JEM SEO - Javascript stopped!");
}
}
function seo_switch() { // Bei jeder Veraenderung werden beide Funktionen aufgerufen
include_keyword();
include_description();
}
function get_keywords() {
$keywords = $("#meta_keywords").val(); // Keywords auslesenen
var $Nullvalue = "[NULL]";
$manual_keywords = ""; // die Anzeige der nicht zuordbaren Variable wird geleert
$keyword = $keywords.split(","); // in eine Array aufspalten
for (var i = 0; i < $keyword.length; i++) { // und alle Leerzeichen entfernen
try { // Die Abfrage wird Fehlersicher gemacht
$keyword[i] = $keyword[i].replace(/ /g, "");
$keyword[i] = $keyword[i].replace(/\[/g, "");
$keyword[i] = $keyword[i].replace(/\]/g, "");
document.getElementById($keyword[i]).value; // ein Fehler wird provoziert, falls dieses Element nicht vorhanden ist
} catch (e) {
if ($manual_keywords != "") { // das nicht verwendete Keyword wird neu abgespeichert
$manual_keywords += ", ";
}
$manual_keywords += $keyword[i];
$keyword[i] = $Nullvalue; // Falls eine angegebene ID nicht vorhanden ist, wird diese aus dem Array entfernt
}
}
var $keyword_count = 0;
var $keyword_length = $keyword.length;
i = 0;
while (i < $keyword_length) {
if ($keyword[i] == $Nullvalue) {
$keyword[i] = $keyword[$keyword.length - $keyword_count - 1];
$keyword[$keyword.length - $keyword_count - 1] = $Nullvalue;
$keyword_length--;
$keyword_count++;
} else {
i++;
}
}
for (i = 0; i < $keyword_count; i++) {
$keyword.pop();
}
}
function get_description() {
$description = $("#meta_description").val(); // uebergebene Bechreibung wird aufgerufen und eingefuegt
if ($description != "") {
var Ergebnis = $description.split("["); // alle relevanten Teile werden getrennt
if (Ergebnis.length > 1) {
$description_vars = new Array(Ergebnis.length - 1); // Neues Array zum eintragen der geforderten Variablen wird angelegt
for (var i = 1; i < Ergebnis.length; i++) {
var inputarray = Ergebnis[i].substring(0, (Ergebnis[i].indexOf("]"))); // die einzelnen Variablen werden aus dem Satz ausgelesen
try { // Die Abfrage wird Fehlersicher gemacht
$description_vars[i - 1] = inputarray;
document.getElementById($description_vars[i - 1]).value;
} catch (e) {
$description_vars.pop();
}
}
} else {
$description_vars = new Array(0);
}
} else {
$description_vars = new Array(0);
}
}
function include_keyword() {
var $keywords = "";
for (var i = 0; i < $keyword.length; i++) { // Es werden alle keywords ausgelesen
if ($keywords != "") {
$keywords += ", ";
}
if (document.getElementById($keyword[i]).tagName == "SELECT") { // es wird unterschieden zwischen normalen Inputfeld und Selectfeld
if (document.getElementById($keyword[i]).value != 0) { // um auch korrekt abspeichern zu koennen wird das Komma richtig gesetzt
$keywords += get_selected_option($keyword[i]); // Auslesen des Wertes aus dem Selectfeld
} else {
$keywords += "[" + $keyword[i] + "]";
}
} else if (document.getElementById($keyword[i]).value != "") {
$keywords += document.getElementById($keyword[i]).value; //Auslesen des Wertes aus dem Inputfeld
} else {
$keywords += "[" + $keyword[i] + "]";
}
}
if ($manual_keywords != "") {
if ($keywords != "") {
$manual_keywords = ", " + $manual_keywords;
}
$keywords = $keywords + $manual_keywords;
}
document.getElementById("meta_keywords").value = $keywords;
}
function include_description() {
var desc_split, desc_value, desc_length;
var desc_output = $description; // Es wird die urspruengliche Ausgabe abgespeichert, da diese im spaeteren Verlauf geaendert wird
for (var i = 0; i < $description_vars.length; i++) {
desc_value = "[" + $description_vars[i] + "]"; // Der Wert wird auf Default gesetzt, damit er ausgegeben werden kann, falls ein deafulteinstellung gewaehlt wird
if (document.getElementById($description_vars[i]).tagName == "SELECT") { // es wird wieder unterschieden zwischen Select und Inputfeld
if (document.getElementById($description_vars[i]).value != 0) {
desc_value = get_selected_option($description_vars[i]);
}
} else {
if (document.getElementById($description_vars[i]).value != "") {
desc_value = document.getElementById($description_vars[i]).value;
}
}
desc_split = desc_output.split("[" + $description_vars[i] + "]"); // Der Satz wird in zwei Teile geteilt
desc_output = ""; // der auszugebene Satz wird geloescht, damit er mit den beiden Haelften wieder befuellt werden kann
desc_length = desc_split.length;
for (var j = 0; j < desc_length; j++) {
desc_output += desc_split[j];
if (j < desc_length - 1) {
desc_output += desc_value; // der Wert wird zwischen beide Texthaelften geschrieben
}
}
}
document.getElementById("meta_description").value = desc_output;
}
function insert_keyword($keyword) {
try {
var $input = document.getElementById($inputbox).value;
if ($inputbox == "meta_keywords") {
if ($input != "") {
$input += ",";
}
}
$input += " " + $keyword;
document.getElementById($inputbox).value = $input;
change_metatags();
} catch (e) {
alert($meta_error);
}
}
function change_metatags() {
if ($inputbox == "meta_keywords") {
$keywords = document.getElementById($inputbox).value;
get_keywords();
} else {
$description = document.getElementById($inputbox).value;
get_description();
}
switchstart();
}
function get_inputbox($input) {
if ($input == "meta_keywords") {
document.getElementById($input).value = $keywords;
} else {
document.getElementById($input).value = $description;
}
$inputbox = $input;
}
function get_selected_option($selectfield) {
var $buffer;
for (i = 0; i < document.getElementById($selectfield).length; i++) {
if (document.getElementById($selectfield).options[i].value == document.getElementById($selectfield).value) {
$buffer = document.getElementById($selectfield).options[i].text;
break;
}
}
return $buffer;
}

View File

@ -0,0 +1,186 @@
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
function changeoldMode() {
if (document.getElementById) {
mode = window.document.adminForm.oldevent.selectedIndex;
switch (mode) {
case 0:
document.getElementById('old').style.display = 'none';
break;
default:
document.getElementById('old').style.display = '';
}
}
}
function changeintegrateMode() {
if (document.getElementById) {
mode = window.document.adminForm.event_comunsolution.selectedIndex;
switch (mode) {
case 0:
document.getElementById('integrate').style.display = 'none';
break;
default:
document.getElementById('integrate').style.display = '';
}
}
}
function changegdMode(mode) {
if (document.getElementById) {
switch (mode) {
case 0:
document.getElementById('gd1').style.display = 'none';
break;
default:
document.getElementById('gd1').style.display = '';
}
}
}
function changemapMode() {
if (document.getElementById) {
mode = window.document.adminForm.showmapserv.selectedIndex;
switch (mode) {
case 0:
document.getElementById('tld').style.display = 'none';
document.getElementById('lg').style.display = 'none';
break;
case 1:
document.getElementById('tld').style.display = '';
document.getElementById('lg').style.display = '';
break;
case 2:
document.getElementById('tld').style.display = '';
document.getElementById('lg').style.display = '';
break;
default:
document.getElementById('tld').style.display = '';
document.getElementById('lg').style.display = '';
}
}
}
function changetitleMode(mode) {
if (document.getElementById) {
switch (mode) {
case 0:
document.getElementById('title1').style.display = 'none';
document.adminForm.titlewidth.value = '';
break;
default:
document.getElementById('title1').style.display = '';
}
}
}
function changelocateMode(mode) {
if (document.getElementById) {
switch (mode) {
case 0:
document.getElementById('locate1').style.display = 'none';
document.adminForm.locationwidth.value = '';
document.getElementById('locate2').style.display = 'none';
break;
default:
document.getElementById('locate1').style.display = '';
document.getElementById('locate2').style.display = '';
}
}
}
function changecityMode(mode) {
if (document.getElementById) {
switch (mode) {
case 0:
document.getElementById('city1').style.display = 'none';
document.adminForm.citywidth.value = '';
break;
default:
document.getElementById('city1').style.display = '';
}
}
}
function changestateMode(mode) {
if (document.getElementById) {
switch (mode) {
case 0:
document.getElementById('state1').style.display = 'none';
document.adminForm.statewidth.value = '';
break;
default:
document.getElementById('state1').style.display = '';
}
}
}
function changecatMode(mode) {
if (document.getElementById) {
switch (mode) {
case 0:
document.getElementById('cat1').style.display = 'none';
document.adminForm.catfrowidth.value = '';
document.getElementById('cat2').style.display = 'none';
break;
default:
document.getElementById('cat1').style.display = '';
document.getElementById('cat2').style.display = '';
}
}
}
function changeatteMode(mode) {
if (document.getElementById) {
switch (mode) {
case 0:
document.getElementById('atte1').style.display = 'none';
document.adminForm.attewidth.value = '';
document.getElementById('atte2').style.display = 'none';
break;
default:
document.getElementById('atte1').style.display = '';
document.getElementById('atte2').style.display = '';
}
}
}
function changeregMode() {
if (document.getElementById) {
mode = window.document.adminForm.showfroregistra.selectedIndex;
switch (mode) {
case 0:
document.getElementById('froreg').style.display = 'none';
break;
default:
document.getElementById('froreg').style.display = '';
}
}
}
document.switcher = null;
if (MooTools.version == '1.11') {
window.onDomReady(function () {
toggler = $('submenu');
element = $('elconfig-document');
if (element) {
document.switcher = new JSwitcher(toggler, element, {cookieName: toggler.getAttribute('class')});
}
});
} else {
// window.addEvent('domready', function() {
jQuery(document).ready(function ($) {
toggler = $('submenu');
element = $('elconfig-document');
if (element) {
document.switcher = new JSwitcher(toggler, element, {cookieName: toggler.getAttribute('class')});
}
});
}

View File

@ -0,0 +1,58 @@
/**
* @package JEM
* @copyright (C) 2013-2015 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/**
* JavaScript behavior to allow selected collapse to be remained after save or page reload
* keeping state in localstorage
*
* @todo use id's for sliders + finetune
*/
jQuery(function() {
var loadcollapse = function() {
var $ = jQuery.noConflict();
jQuery(document).find('a[data-toggle="collapse"]').on('click', function(e) {
// Store the selected collapse href in localstorage
window.localStorage.setItem('collapse-href', $(e.target).attr('href'));
});
var activatecollapse = function(href) {
var $el = $('a[data-toggle="collapse"]a[href*=' + href + ']');
var $el2 = $el.parent().parent().parent();
var $el3 = $el2.find(".accordion-body");
$el3.collapse('show');
};
var hascollapse = function(href){
return $('a[data-toggle="collapse"]a[href*=' + href + ']').length;
};
if (localStorage.getItem('collapse-href')) {
// When moving from collapse area to a different view
if(!hascollapse(localStorage.getItem('collapse-href'))){
localStorage.removeItem('collapse-href');
return true;
}
// Clean default collapse
$('a[data-toggle="collapse"]').parent().removeClass('in');
var collapsehref = localStorage.getItem('collapse-href');
// Add active attribute for selected collapse indicated by url
activatecollapse(collapsehref);
// Check whether internal collapse is selected (in format <collapsename>-<id>)
var seperatorIndex = collapsehref.indexOf('-');
if (seperatorIndex !== -1) {
var singular = collapsehref.substring(0, seperatorIndex);
var plural = singular + "s";
activatecollapse(plural);
}
}
};
setTimeout(loadcollapse, 100);
});

View File

@ -0,0 +1,23 @@
/**
* @package JEM
* @copyright (C) 2013-2024 joomlaeventmanager.net
* @copyright (C) 2005-2009 Christoph Lukes
* @license https://www.gnu.org/licenses/gpl-3.0 GNU/GPL
*/
function unlimited_starter() {
document.getElementById('adminForm').onsubmit = submit_unlimited;
}
function include_unlimited($unlimited_name) {
document.getElementById("recurrence_limit_date").value = $unlimited_name; // write the word "unlimited" in the textbox
return false;
}
function submit_unlimited() {
var $value = document.getElementById("recurrence_limit_date").value;
var $date_array = $value.split("-");
if ($date_array.length < 3) {
document.getElementById("recurrence_limit_date").value = "0000-00-00";
}
}