materio_page_title.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // @codekit-prepend "gui.js"
  2. // @koala-prepend "gui.js"
  3. (function($) {
  4. MaterioPageTitle = function(){
  5. function init(){
  6. $(document)
  7. .bind('materio-page-title-refresh-block', onRefreshBlock)
  8. .bind('list-edited', onListEdited);
  9. };
  10. function onRefreshBlock(event){
  11. trace('MaterioPageTitle :: onRefreshBlock', event);
  12. // var url = Drupal.settings.basePath+Drupal.settings.pathPrefix+'materio_page_title/refresh/block';
  13. // $.getJSON(url, function(json){
  14. // trace('page title json', json);
  15. // $('#block-materio-page-title-materio-page-title').replaceWith(json.block);
  16. // });
  17. if(typeof event.title !== 'undefined')
  18. $('#block-materio-page-title-materio-page-title h1').html(event.title);
  19. };
  20. function onListEdited(event){
  21. trace('MaterioPageTitle :: onListEdited', event);
  22. // this is for refreshing page title when list title was just edited AND this list is the cirreunt list
  23. if($("#materio-page-title ."+event.name).length)
  24. $('a.open-list.'+event.name).eq(0).trigger('click');
  25. };
  26. init();
  27. };
  28. $(document).ready(function() {
  29. var materiopagetitle = new MaterioPageTitle();
  30. });
  31. })(jQuery);