Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/ecampus/public_html/ce/lib/weblib.php on line 2976
Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/ecampus/public_html/ce/lib/weblib.php on line 2977
Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/ecampus/public_html/ce/lib/weblib.php on line 2979
Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/ecampus/public_html/ce/lib/moodlelib.php on line 5632
require(['core/first'], function() {
require(['theme_bootstrapbase/bootstrap', 'core/log'], function(bootstrap, log) {
log.debug('Bootstrap initialised');
});
});
/**
* Customise the dock for this theme.
*
* Tasks we do within this function:
* - Add 'block' as a class to the dock panel so that its items are styled the same as they are when being displayed
* in page as blocks.
* - Constrain the width of the docked block to the window width using a responsible max-width.
* - Handle the opening/closing of the Bootstrap collapsible navbar on small screens.
*/
function customise_dock_for_theme(dock) {
// Add the "block" class to docked blocks.
// This prevents having to restyle all docked blocks and simply use standard block styling.
// First we wait until the panel has been generated.
dock.on('dock:panelgenerated', function() {
// Then we wait until the panel it is being shown for the first time.
dock.get('panel').once('dockpanel:beforeshow', function() {
// Finally we add the block class.
Y.all('.dockeditempanel_content').addClass('block');
});
dock.get('panel').on('dockpanel:beforeshow', function() {
var content = Y.all('.dockeditempanel_content');
// Finally set a responsible max width.
content.setStyle('maxWidth', content.get('winWidth') - dock.get('dockNode').get('offsetWidth') - 10);
});
});
// Handle the opening/closing of the bootstrap collapsible navbar on small screens.
// This is a complex little bit of JS because we need to simulate Bootstrap actions in order to measure height changes
// in the dom and apply them as spacing to the dock.
dock.on('dock:initialised', function() {
var navbar = Y.one('header.navbar'),
navbarbtn = Y.one('header.navbar .btn-navbar'),
navcollapse = Y.one('header.navbar .nav-collapse'),
container = Y.one('#dock .dockeditem_container'),
margintop = null,
newmargintop = null,
diff = null;
if (navbar && navbarbtn && container) {
margintop = parseInt(container.getStyle('marginTop').replace(/px$/, ''), 10);
diff = margintop - parseInt(navbar.get('offsetHeight'), 10);
navbarbtn.ancestor().on('click', function() {
// We need to fake the collapsible region being active, this JS *ALWAYS* executes before the bootstrap JS.
navcollapse.toggleClass('active');
if (!this.hasClass('active')) {
newmargintop = (parseInt(navbar.get('offsetHeight'), 10) + diff);
container.setStyle('marginTop', newmargintop + 'px');
} else {
container.setStyle('marginTop', margintop + 'px');
}
// Undo the simulation.
navcollapse.toggleClass('active');
// Tell the dock things have changed so that it automatically resizes things.
dock.fire('dock:itemschanged');
}, navbarbtn);
}
});
}
require(['core/first'], function() { // jshint ignore:line
require(['theme_essential/anti_gravity', 'core/log'], function(ag, log) { // jshint ignore:line
log.debug('Essential JavaScript initialised');
});
});
// Replacement core JS for using FontAwesome icons instead.
M.util.init_block_hider = function(Y, config) {
Y.use('base', 'node', function(Y) {
M.util.block_hider = M.util.block_hider || (function(){
var blockhider = function() {
blockhider.superclass.constructor.apply(this, arguments);
};
blockhider.prototype = {
initializer : function(config) {
this.set('block', '#' + this.get('id'));
var b = this.get('block'),
t = b.one('.title'),
a = null,
hide,
show;
if (t && (a = t.one('.block_action'))) {
hide = Y.Node.create('');
hide.addClass('block-hider-hide ' + this.get('iconVisible'));
hide.setAttrs({
'aria-hidden': true,
'aria-label': config.tooltipVisible,
tabIndex: 0,
'title': config.tooltipVisible
});
hide.on('keypress', this.updateStateKey, this, true);
hide.on('click', this.updateState, this, true);
show = Y.Node.create('');
show.addClass('block-hider-show ' + this.get('iconHidden'));
show.setAttrs({
'aria-hidden': true,
'aria-label': config.tooltipHidden,
tabIndex: 0,
'title': config.tooltipHidden
});
show.on('keypress', this.updateStateKey, this, false);
show.on('click', this.updateState, this, false);
a.insert(show, 0).insert(hide, 0);
}
},
updateState : function(e, hide) {
M.util.set_user_preference(this.get('preference'), hide);
if (hide) {
this.get('block').addClass('hidden');
this.get('block').one('.block-hider-show').focus();
} else {
this.get('block').removeClass('hidden');
this.get('block').one('.block-hider-hide').focus();
}
},
updateStateKey : function(e, hide) {
if (e.keyCode == 13) { // Allow hide/show via enter key.
this.updateState(this, hide);
}
}
};
Y.extend(blockhider, Y.Base, blockhider.prototype, {
NAME : 'blockhider',
ATTRS : {
id : {},
preference : {},
iconVisible : {
value : 'icon fa fa-minus-square-o fa-fw'
},
iconHidden : {
value : 'icon fa fa-plus-square-o fa-fw'
},
block : {
setter : function(node) {
return Y.one(node);
}
}
}
});
return blockhider;
})();
new M.util.block_hider(config);
});
};
/**
* Customise the dock for this theme.
*
* Tasks we do within this function:
* - Add 'block' as a class to the dock panel so that its items are styled the same as they are when being displayed
* in page as blocks.
* - Constrain the width of the docked block to the window width using a responsible max-width.
* - Handle the opening/closing of the Bootstrap collapsible navbar on small screens.
*/
function customise_dock_for_theme(dock) {
// Add the "block" class to docked blocks.
// This prevents having to restyle all docked blocks and simply use standard block styling.
// First we wait until the panel has been generated.
dock.on('dock:panelgenerated', function () {
// Then we wait until the panel it is being shown for the first time.
dock.get('panel').once('dockpanel:beforeshow', function () {
// Finally we add the block class.
Y.all('.dockeditempanel_content').addClass('block');
});
dock.get('panel').on('dockpanel:beforeshow', function () {
var content = Y.all('.dockeditempanel_content');
// Finally set a responsible max width.
content.setStyle('maxWidth', content.get('winWidth') - dock.get('dockNode').get('offsetWidth') - 10);
});
});
// Handle the opening/closing of the bootstrap collapsible navbar on small screens.
// This is a complex little bit of JS because we need to simulate Bootstrap actions in order to measure height changes
// in the dom and apply them as spacing to the dock.
dock.on('dock:initialised', function () {
var navbar = Y.one('header.navbar'),
navbarbtn = Y.one('header.navbar .btn-navbar'),
navcollapse = Y.one('header.navbar .nav-collapse'),
container = Y.one('#dock .dockeditem_container'),
margintop = null,
newmargintop = null,
diff = null;
if (navbar && navbarbtn && container) {
margintop = parseInt(container.getStyle('marginTop').replace(/px$/, ''), 10);
diff = margintop - parseInt(navbar.get('offsetHeight'), 10);
navbarbtn.ancestor().on('click', function () {
// We need to fake the collapsible region being active, this JS *ALWAYS* executes before the bootstrap JS.
navcollapse.toggleClass('active');
if (!this.hasClass('active')) {
newmargintop = (parseInt(navbar.get('offsetHeight'), 10) + diff);
container.setStyle('marginTop', newmargintop + 'px');
} else {
container.setStyle('marginTop', margintop + 'px');
}
// Undo the simulation.
navcollapse.toggleClass('active');
// Tell the dock things have changed so that it automatically resizes things.
dock.fire('dock:itemschanged');
}, navbarbtn);
}
});
}