Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

75 rindas
2.1 KiB

  1. (function($){
  2. $.fn.addAnchor = function(title) {
  3. title = title || "Link here";
  4. return this.filter("*[@id]").each(function() {
  5. $("<a class='anchor'> \u00B6</a>").attr("href", "#" + this.id)
  6. .attr("title", title).appendTo(this);
  7. });
  8. }
  9. $.fn.checked = function(checked) {
  10. if (checked == undefined) { // getter
  11. if (!this.length) return false;
  12. return this.get(0).checked;
  13. } else { // setter
  14. return this.each(function() {
  15. this.checked = checked;
  16. });
  17. }
  18. }
  19. $.fn.enable = function(enabled) {
  20. if (enabled == undefined) enabled = true;
  21. return this.each(function() {
  22. this.disabled = !enabled;
  23. var label = $(this).parents("label");
  24. if (!label.length && this.id) {
  25. label = $("label[@for='" + this.id + "']");
  26. }
  27. if (!enabled) {
  28. label.addClass("disabled");
  29. } else {
  30. label.removeClass("disabled");
  31. }
  32. });
  33. }
  34. $.loadStyleSheet = function(href, type) {
  35. type = type || "text/css";
  36. $(document).ready(function() {
  37. if (document.createStyleSheet) { // MSIE
  38. document.createStyleSheet(href);
  39. } else {
  40. $("<link rel='stylesheet' type='" + type + "' href='" + href + "' />")
  41. .appendTo("head");
  42. }
  43. });
  44. }
  45. // Used for dynamically updating the height of a textarea
  46. window.resizeTextArea = function (id, rows) {
  47. var textarea = $("#" + id).get(0);
  48. if (!textarea || textarea.rows == undefined) return;
  49. textarea.rows = rows;
  50. }
  51. // The following are defined for backwards compatibility with releases prior
  52. // to Trac 0.11
  53. window.addEvent = function(elem, type, func) {
  54. $(elem).bind(type, func);
  55. }
  56. window.addHeadingLinks = function(container, title) {
  57. $.each(["h1", "h2", "h3", "h4", "h5", "h6"], function() {
  58. $(this, container).addAnchor(title);
  59. });
  60. }
  61. window.enableControl = function(id, enabled) {
  62. $("#" + id).enable(enabled);
  63. }
  64. window.getAncestorByTagName = function(elem, tagName) {
  65. return $(elem).parents(tagName).get(0);
  66. }
  67. })(jQuery);