2013-08-28 27 views
0

我需要禁用所有的Joomla內聯樣式。禁用所有的Joomla 3.0內聯樣式

我的查詢不是關於文本編輯器。 在大多數情況下,我根本沒有使用內聯樣式。

它確實讓我回想起當前使用自定義模板的項目。

任何解決方案?或插件? (我已經搜索)

+0

也許添加一些jQuery的代碼主要模板? – Shaz

+0

我知道我可以做到這一點以及通過CSS重寫[風格]。但我更喜歡更清潔的解決方案。 – Undefined

+0

你在哪裏看到內聯風格,我認爲Joomla 3.1核心沒有任何內聯風格。 – Craig

回答

0

注意,這將從所有元素刪除內聯「風格」屬性:

<script type="text/javascript"> 
(function($){ 
    $(document).ready(function(){ 
     $(this).find("*").removeAttr("style"); 
    }); 
})(jQuery); 
</script> 

要絕對有效的,把它僅僅是</body>標記之前,萬一你可能有任何其他jQuery腳本添加CSS(「東西」)的元素。

0

這裏有一個簡單的插件,你可以運行,並用它來尋找哪些元素包含哪些屬性,例如,類,樣式,標題,寬度等 小提琴在http://jsfiddle.net/SyFum/2/

<script type="text/javascript"> 
    (function ($) { 
     $(document).ready(function() { 

      /** 
      * Highlight all elements that contain an attribute 
      * @param attributeToSearch string The attribute to be found 
      * @returns {*} The elements, containing the attribute, bordered 
      */ 
      $.fn.StyleHighlighter = function (attributeToSearch) { 
       // set the defaults 
       var defaults = { 
        attributeToSearch : "style" 
       }; 

       $(this).find("*").each(function() { 

        if ($(this).attr(attributeToSearch)) 
        { 
         $(this).css("border", "1px dashed #ff0000"); 
        } 
       }); 
       return this; 
      }; 

      // Usage (style, class, title, whatever) 
      $(this).StyleHighlighter("style"); 
     }); 
    })(jQuery); 
    </script>