/* jquery.gcal_flow_126_Weddings20190609.txt */
// Version: 1.2.6
// Generated by CoffeeScript 1.4.0
// Function gCalFlow.prototype.parse_date
// Added "offset=0;" because when in Summer time and looking at times in non-Summer time, the hour was out by an hour. Ignoring the offset corrects this as times are not stored according to BST or not.
// Function gCalFlow.prototype.gcal_url
// Changed function to handle Google's V3 API
// Added new option 'apikey'
// Function gCalFlow.prototype.render_data
// Removed call to gcf-item-update-date as don't use it so unnecessary call.
// Added code to restrict description to 70 characters max.
// Added code to delete Map coordinates and Postcode in Location.
// Added code to restrict weddings displayed to a particular church or to all churches - can't do this in the query string!
// Added code to hide the header if no weddings found
// Added IF to amend page header to include the name of the church if specified
// Changed function to handle Google's V3 API
// Added code to handle if these fields are blank: ent.summary, ent.description, ent.location
(function() {
var $, gCalFlow, log, methods, pad_zero, _ref;
// Turn on logging via Browser Console
// window._gCalFlow_debug = true;
$ = jQuery;
if ((typeof window !== "undefined" && window !== null) && (window._gCalFlow_debug != null) && (typeof console !== "undefined" && console !== null)) {
log = console;
if ((_ref = log.debug) == null) {
log.debug = log.log;
}
} else {
log = {};
log.error = log.warn = log.log = log.info = log.debug = function() {};
}
pad_zero = function(num, size) {
var i, ret, _i, _ref1;
if (size == null) {
size = 2;
}
if (10 * (size - 1) <= num) {
return num;
}
ret = "";
for (i = _i = 1, _ref1 = size - ("" + num).length; 1 <= _ref1 ? _i <= _ref1 : _i >= _ref1; i = 1 <= _ref1 ? ++_i : --_i) {
ret = ret.concat("0");
}
return ret.concat(num);
};
gCalFlow = (function() {
gCalFlow.prototype.target = null;
gCalFlow.prototype.template = $("
'
}
log.debug("Number of weddings:", myCount);
// RC: Added IF to check if no weddings found for church, and hide the table header
if (myCount == 0) {
items = $('
|
').html(this.opts.no_items_html);
t.find('#with-my-template-head').css('display','none');
}
// RC: Added IF to amend page header to include the name of the church if specified
if (this.opts.my_church) {
$('#headingContainer').html('
Weddings List ~ '+this.opts.my_church_is+'
');
}
$('#id_453_logoX').html('
');
log.debug("rendering done. number of entries:", items.length);
log.debug("formatted item entry array:", items);
ic = t.find('.gcf-item-container-block');
log.debug("item container element:", ic);
ic.html(items);
this.target.html(t.html());
this.bind_scroll();
if (this.opts.callback) {
return this.opts.callback.apply(this.target);
}
};
gCalFlow.prototype.bind_scroll = function() {
var scroll_children, scroll_container, scroll_timer, scroller, state;
scroll_container = this.target.find('.gcf-item-container-block');
scroll_children = scroll_container.find(".gcf-item-block");
log.debug("scroll container:", scroll_container);
if (!this.opts.auto_scroll || scroll_container.size() < 1 || scroll_children.size() < 2) {
return;
}
state = {
idx: 0
};
scroller = function() {
var scroll_to;
log.debug("current scroll position:", scroll_container.scrollTop());
log.debug("scroll capacity:", scroll_container[0].scrollHeight - scroll_container[0].clientHeight);
if (typeof scroll_children[state.idx] === 'undefined' || scroll_container.scrollTop() >= scroll_container[0].scrollHeight - scroll_container[0].clientHeight) {
log.debug("scroll to top");
state.idx = 0;
return scroll_container.animate({
scrollTop: scroll_children[0].offsetTop
});
} else {
scroll_to = scroll_children[state.idx].offsetTop;
log.debug("scroll to " + scroll_to + "px");
scroll_container.animate({
scrollTop: scroll_to
});
return state.idx += 1;
}
};
return scroll_timer = setInterval(scroller, this.opts.scroll_interval);
};
return gCalFlow;
})();
methods = {
init: function(opts) {
var data;
if (opts == null) {
opts = {};
}
data = this.data('gCalFlow');
if (!data) {
return this.data('gCalFlow', {
target: this,
obj: new gCalFlow(this, opts)
});
}
},
destroy: function() {
var data;
data = this.data('gCalFlow');
data.obj.target = null;
$(window).unbind('.gCalFlow');
data.gCalFlow.remove();
return this.removeData('gCalFlow');
},
render: function() {
if ((typeof Globalize !== "undefined" && Globalize !== null) && (Globalize.culture != null)) {
Globalize.culture(this.data('gCalFlow').obj.opts.globalize_culture);
}
return this.data('gCalFlow').obj.fetch();
}
};
$.fn.gCalFlow = function(method) {
var orig_args;
orig_args = arguments;
if (typeof method === 'object' || !method) {
return this.each(function() {
methods.init.apply($(this), orig_args);
return methods.render.apply($(this), orig_args);
});
} else if (methods[method]) {
return this.each(function() {
return methods[method].apply($(this), Array.prototype.slice.call(orig_args, 1));
});
} else if (method === 'version') {
return "1.2.6";
} else {
return $.error("Method " + method + " does not exist on jQuery.gCalFlow");
}
};
}).call(this);