foreground.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. jQuery(document).ready(function() {
  2. // Add the 'less than IE9' class to appropriate version of IE by checking for their support of cssFloat (true in v9)
  3. if (!jQuery.support.cssFloat) { jQuery('html').addClass('lt-ie9').addClass('no-js'); }
  4. jQuery(document).foundation(function (response) {
  5. // console.log(response.errors); < this line will produce error in ie9!
  6. if (window.console) console.log(response.errors);
  7. });
  8. // The Echo extension puts an item in personal tools that Foreground really should have in the top menu
  9. // to make this easier, we move it here and loaded earlier to speed up transform
  10. jQuery("#pt-notifications").prependTo("#echo-notifications");
  11. // Add classes for font-awesome
  12. jQuery('[id^=ca-nstab] a').addClass('fa fa-file fa-fw').text(' ' + jQuery('[id^=ca-nstab] a').text());
  13. jQuery('li#ca-talk a').addClass('fa fa-comments fa-fw').text(' ' + jQuery('li#ca-talk a').text());
  14. jQuery('li#ca-talk.new a').addClass('fa fa-comments-o fa-fw').text(' ' + jQuery('li#ca-talk.new a').text());
  15. jQuery('li#ca-edit a').addClass('fa fa-pencil-square-o fa-fw').text(' ' + jQuery('li#ca-edit a').text());
  16. jQuery('li#ca-viewsource a').addClass('fa fa-book fa-fw').text(' ' + jQuery('li#ca-viewsource a').text());
  17. jQuery('li#ca-form_edit a').addClass('fa fa-pencil-square fa-fw').text(' ' + jQuery('li#ca-form_edit a').text());
  18. jQuery('li#ca-history a').addClass('fa fa-archive fa-fw').text(' ' + jQuery('li#ca-history a').text());
  19. jQuery('li#ca-delete a').addClass('fa fa-trash-o fa-fw').text(' ' + jQuery('li#ca-delete a').text());
  20. jQuery('li#ca-undelete a').addClass('fa fa-undo fa-fw').text(' ' + jQuery('li#ca-undelete a').text());
  21. jQuery('li#ca-move a').addClass('fa fa-truck fa-fw').text(' ' + jQuery('li#ca-move a').text());
  22. jQuery('li#ca-protect a').addClass('fa fa-shield fa-fw').text(' ' + jQuery('li#ca-protect a').text());
  23. jQuery('li#ca-unprotect a').addClass('fa fa-shield fa-fw').text(' ' + jQuery('li#ca-unprotect a').text());
  24. jQuery('li#ca-watch a').addClass('fa fa-star-o fa-fw').text(' ' + jQuery('li#ca-watch a').text());
  25. jQuery('li#ca-unwatch a').addClass('fa fa-star fa-fw').text(' ' + jQuery('li#ca-unwatch a').text());
  26. jQuery('li#ca-purge a').addClass('fa fa-refresh fa-fw').text(' ' + jQuery('li#ca-purge a').text());
  27. jQuery('li#ca-ask_delete_permanently a').addClass('fa fa-cut fa-fw').text(' ' + jQuery('li#ca-ask_delete_permanently a').text());
  28. if ( jQuery( '#ca-addsection' ).length ) {
  29. jQuery('li#ca-addsection a').addClass('fa fa-plus fa-fw').text(' ' + jQuery('li#ca-addsection a').attr('title').replace(/\[.+/g,""));
  30. }
  31. jQuery('li#pt-userpage a').addClass('fa fa-user').text(' ' + jQuery('li#pt-userpage a').text());
  32. jQuery('li#pt-mytalk a').addClass('fa fa-comments').text(' ' + jQuery('li#pt-mytalk a').text());
  33. jQuery('li#pt-adminlinks a').addClass('fa fa-bolt').text(' ' + jQuery('li#pt-adminlinks a').text());
  34. jQuery('li#pt-preferences a').addClass('fa fa-ellipsis-h').text(' ' + jQuery('li#pt-preferences a').text());
  35. jQuery('li#pt-watchlist a').addClass('fa fa-th-list').text(' ' + jQuery('li#pt-watchlist a').text());
  36. jQuery('li#pt-mycontris a').addClass('fa fa-smile-o').text(' ' + jQuery('li#pt-mycontris a').text());
  37. jQuery('li#pt-logout a').addClass('fa fa-power-off').text(' ' + jQuery('li#pt-logout a').text());
  38. jQuery('li#t-smwbrowselink a').addClass('fa fa-eye').text(' ' + jQuery('li#t-smwbrowselink a').text());
  39. jQuery('li#t-whatlinkshere a').addClass('fa fa-arrows').text(' ' + jQuery('li#t-whatlinkshere a').text());
  40. jQuery('li#t-blockip a').addClass('fa fa-ban').text(' ' + jQuery('li#t-blockip a').text());
  41. jQuery('li#t-recentchangeslinked a').addClass('fa fa-bars').text(' ' + jQuery('li#t-recentchangeslinked a').text());
  42. jQuery('li#t-contributions a').addClass('fa fa-smile-o').text(' ' + jQuery('li#t-contributions a').text());
  43. jQuery('li#t-log a').addClass('fa fa-bars').text(' ' + jQuery('li#t-log a').text());
  44. jQuery('li#t-emailuser a').addClass('fa fa-envelope').text(' ' + jQuery('li#t-emailuser a').text());
  45. jQuery('li#t-userrights a').addClass('fa fa-gavel').text(' ' + jQuery('li#t-userrights a').text());
  46. jQuery('li#t-upload a').addClass('fa fa-upload').text(' ' + jQuery('li#t-upload a').text());
  47. jQuery('li#t-specialpages a').addClass('fa fa-magic').text(' ' + jQuery('li#t-specialpages a').text());
  48. jQuery('li#t-print a').addClass('fa fa-print').text(' ' + jQuery('li#t-print a').text());
  49. jQuery('li#t-permalink a').addClass('fa fa-dot-circle-o').text(' ' + jQuery('li#t-permalink a').text());
  50. jQuery('li#t-info a').addClass('fa fa-info').text(' ' + jQuery('li#t-info a').text());
  51. jQuery('ul#toolbox-dropdown.dropdown>li#n-recentchanges a').addClass('fa fa-tasks').text(' ' + jQuery('ul#toolbox-dropdown.dropdown>li#n-recentchanges a').text());
  52. jQuery('ul#toolbox-dropdown.dropdown>li#n-help a').addClass('fa fa-question').text(' ' + jQuery('ul#toolbox-dropdown.dropdown>li#n-help a').text());
  53. // Turn categories into labels
  54. jQuery('#mw-normal-catlinks ul li a').addClass('label');
  55. // Make the Page Action button respond to hover
  56. jQuery('a.button.dropdown').mouseenter(function(){
  57. jQuery('ul#drop1').addClass('open').addClass('right').css('top', '32px').css('left', '785px');
  58. });
  59. jQuery('ul#drop1').mouseleave(function(){
  60. jQuery('ul#drop1').removeClass('open').css('top', '-9999px').css('left', '785px');
  61. });
  62. });