11 var Ajax =
require(
'elgg/Ajax');
12 var
ajax =
new Ajax(
false);
14 function changeTab($tab) {
16 $tab.siblings().andSelf().removeClass(
'elgg-state-selected');
17 $tab.addClass(
'elgg-state-selected');
19 var
$target = $tab.data(
'target');
20 if (!$target || !$target.length) {
24 $target.siblings().addClass(
'hidden').removeClass(
'elgg-state-active');
25 $target.removeClass(
'hidden').addClass(
'elgg-state-active');
30 $(
document).
on(
'click',
'.elgg-tabs-component .elgg-tabs > li > a',
function (e) {
34 var $tab = $(
this).parent();
35 var $component = $(
this).closest(
'.elgg-tabs-component');
36 var
$content = $component.find(
'.elgg-tabs-content');
38 var href = $link.data(
'ajaxHref') || $link.attr(
'href');
39 var $target = $tab.data(
'target');
41 if (href.indexOf(
'#') === 0) {
43 if (!$target || !$target.length) {
44 var $target = $content.find(href);
45 $tab.data(
'target', $target);
48 if (changeTab($tab)) {
54 if (!$target || !$target.length) {
55 var $target = $(
'<div>').addClass(
'elgg-content hidden');
56 $content.append($target);
57 $tab.data(
'target', $target);
60 if ($tab.data(
'loaded') && !$link.data(
'ajaxReload')) {
61 if (changeTab($tab)) {
68 data: $link.data(
'ajaxQuery') || {},
69 beforeSend:
function () {
71 $target.addClass(
'elgg-ajax-loader');
73 }).done(
function (
output, statusText, jqXHR) {
74 $tab.data(
'loaded',
true);
75 $target.removeClass(
'elgg-ajax-loader');
76 if (jqXHR.AjaxData.status === -1) {
77 $target.html(elgg.echo(
'ajax:error'));
83 if (changeTab($tab)) {
92 $(
'.elgg-tabs-component .elgg-tabs > li.elgg-state-selected > a').trigger(
'click');
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed on
elgg ajax
Wrapper function for jQuery.ajax which ensures that the url being called is relative to the elgg site...
elgg require
Throw an error if the required package isn't present.
define(function(require){var elgg=require('elgg');require('elgg/ready');var $=require('jquery');var Ajax=require('elgg/Ajax');var ajax=new Ajax(false);function changeTab($tab){$tab.siblings().andSelf().removeClass('elgg-state-selected');$tab.addClass('elgg-state-selected');var $target=$tab.data('target');if(!$target||!$target.length){return false;}$target.siblings().addClass('hidden').removeClass('elgg-state-active');$target.removeClass('hidden').addClass('elgg-state-active');return true;}$(document).on('click', '.elgg-tabs-component.elgg-tabs > li > a', function(e){e.preventDefault();var $link=$(this);var $tab=$(this).parent();var $component=$(this).closest('.elgg-tabs-component');var $content=$component.find('.elgg-tabs-content');var href=$link.data('ajaxHref')||$link.attr('href');var $target=$tab.data('target');if(href.indexOf('#')===0){if(!$target||!$target.length){var $target=$content.find(href);$tab.data('target', $target);}if(changeTab($tab)){$tab.trigger('open');return;}}else{if(!$target||!$target.length){var $target=$('< div >').addClass('elgg-content hidden');$content.append($target);$tab.data('target', $target);}if($tab.data('loaded')&&!$link.data('ajaxReload')){if(changeTab($tab)){$tab.trigger('open');return;}}ajax.path(href,{data:$link.data('ajaxQuery')||{}, beforeSend:function(){changeTab($tab);$target.addClass('elgg-ajax-loader');}}).done(function(output, statusText, jqXHR){$tab.data('loaded', true);$target.removeClass('elgg-ajax-loader');if(jqXHR.AjaxData.status===-1){$target.html(elgg.echo('ajax:error'));return;}else{$target.html(output);}if(changeTab($tab)){$tab.trigger('open');}});}});$('.elgg-tabs-component.elgg-tabs > li.elgg-state-selected > a').trigger('click');})
Tabbed module.
GNU GENERAL PUBLIC LICENSE June Free Software Inc Franklin Fifth MA USA Everyone is permitted to copy and distribute verbatim copies of this license document
$content
Set robots.txt action.