Current Directory: /home/astoriaah/www/old15/administrator/components/com_jce/media/js
Viewing File: /home/astoriaah/www/old15/administrator/components/com_jce/media/js/help.min.js
/**
* @package JCE
* @copyright Copyright (c) 2009-2018 Ryan Demmer. All rights reserved.
* @license GNU/GPL 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* JCE is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
*/
(function($, Wf) {
Wf.help = {
options: {
url: '',
key: [],
pattern: ''
},
init: function(options) {
var key, id, n, self = this;
this.options = $.extend(this.options, options);
$('dd.subtopics', '#help-menu').click(function() {
// hide all
$(this).parent('dl').children('dl').addClass('hidden');
// toggle clicked
$(this).next('dl').removeClass('hidden');
});
$('dd', '#help-menu').click(function(e) {
if (this.id == '') {
return;
}
$('dd.loading', '#help-menu').removeClass('loading');
self.loadItem(this);
});
$('iframe#help-iframe').load(function() {
$('.loading', '#help-menu').removeClass('loading');
});
key = this.options.key;
if (!key.length || !$('#' + key.join('.')).length) {
$('dd', '#help-menu').eq(0).click();
} else {
$('#' + key.join('.')).click();
}
$('#help-menu-toggle div.toggle-handle').click(function() {
var n = this;
$(n).toggleClass('collapsed');
$('#help-menu').parent().toggle();
$('#help-frame').parent().toggleClass('span8 span12');
$(n).parent().css('left', function() {
if ($(n).hasClass('collapsed')) {
return 0;
}
return $('#help-menu').parent().outerWidth();
});
// resize frame
self.resizeFrame();
});
$("#help-menu-toggle").draggable({
'opacity': 0.7,
'helper': function() {
return $('<div id="help-menu-toggle-clone" />').height($('#help-menu-toggle').height());
},
'axis': "x",
'containment': "parent",
start: function() {
$('#help-frame').css('visibility', 'hidden');
},
stop: function(e, ui) {
$('#help-frame').css('visibility', 'visible');
var pos = Math.max(Math.round(ui.position.left) - 10, 0);
if (pos === 0) {
return $('#help-menu-toggle div.toggle-handle').click();
}
var size = Math.round(ui.position.left);
$('#help-menu').parent().width(size - 22);
$('#help-frame').parent().width($('div.row-fluid').width() - size - 14);
$("#help-menu-toggle").css('left', size);
}
});
},
resizeFrame: function() {
var self = this,
s;
$('#help-frame').parent().css('width', function() {
if ($("#help-menu-toggle div.toggle-handle").hasClass('collapsed')) {
s = $("#help-menu-toggle").outerWidth(true);
}
return $('div.row-fluid').width() - self.getMenuSize(s) - 1;
});
},
getMenuSize: function(pos) {
if (typeof pos == 'undefined') {
pos = $('#help-menu').parent().outerWidth() + 14;
}
return pos;
},
loadItem: function(el) {
var s, n, keys, p, map;
$(el).addClass('loading');
var id = $(el).attr('id');
if (this.options.pattern) {
keys = id.split('.');
map = {
'section': keys[0] || '',
'category': keys[1] || '',
'article': keys[2] || ''
};
p = this.options.pattern;
s = p.replace(/\{\$([^\}]+)\}/g, function(a, b) {
return map[b] || '';
});
} else {
s = id;
}
$('iframe#help-iframe').attr('src', this.options.url + s);
}
}
})(jQuery, Wf);