2013-08-28 29 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>