44 lines
1.2 KiB
JavaScript
44 lines
1.2 KiB
JavaScript
// @codekit-prepend "gui.js"
|
|
// @koala-prepend "gui.js"
|
|
|
|
(function($) {
|
|
|
|
MaterioPageTitle = function(){
|
|
|
|
function init(){
|
|
$(document)
|
|
.bind('materio-page-title-refresh-block', onRefreshBlock)
|
|
.bind('list-edited', onListEdited);
|
|
|
|
};
|
|
|
|
function onRefreshBlock(event){
|
|
trace('MaterioPageTitle :: onRefreshBlock', event);
|
|
// var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materio_page_title/refresh/block';
|
|
// $.getJSON(url, function(json){
|
|
// trace('page title json', json);
|
|
// $('#block-materio-page-title-materio-page-title').replaceWith(json.block);
|
|
// });
|
|
if(typeof event.title !== 'undefined')
|
|
$('#block-materio-page-title-materio-page-title h1').html(event.title);
|
|
};
|
|
|
|
function onListEdited(event){
|
|
trace('MaterioPageTitle :: onListEdited', event);
|
|
|
|
// this is for refreshing page title when list title was just edited AND this list is the cirreunt list
|
|
if($("#materio-page-title ."+event.name).length)
|
|
$('a.open-list.'+event.name).eq(0).trigger('click');
|
|
|
|
};
|
|
|
|
|
|
init();
|
|
};
|
|
|
|
$(document).ready(function() {
|
|
var materiopagetitle = new MaterioPageTitle();
|
|
});
|
|
|
|
|
|
})(jQuery); |