Javascript工具栏

SSSK

我正在将javascript工具栏调整为Joomla CMS模块。此javascript工具栏具有许多按钮,其中每个按钮都调用一个javascript文件(插件)。当前工具栏是在Javascript上完成的。

这是加载工具栏的代码。

调用工具栏及其插件的初始代码;

"undefined"==typeof window.AtKit?(d=document,jf=d.createElement("script"),jf.src="http://domain.com/jw3c/atkit.min.js",jf.type="text/javascript",jf.id="AtKitLib",d.getElementsByTagName("head")[0].appendChild(jf),window.AtKitLoaded=function(){var c=null;this.subscribe=function(b){c=b};this.fire=function(b,e){null!=c&&c(b,e)}},window.AtKitLoaded=new AtKitLoaded,window.AtKitLoaded.subscribe(function(){__start()})):__start();
function __start(){var c=window,b=AtKit;$lib=b.lib();var e="ftw resize fonts spellng dictionary insipio-tts readability wordprediction css overlay shortcutkeys tooltip".split(" ");b.importPlugins(e,function(){b.setLogo("http://domain.com/services/logo.jpg");b.setName("JW3C");"undefined"==typeof c.AtKitLanguage?b.setLanguage("en"):b.setLanguage(c.AtKitLanguage);var a;a="Version 1.0.0<p style=\"line-height:120%\">Created by <a href='http://domain.com'>S</a>, <a href='http://www.domain.my/'></a>.<br><br>";
a+="Fugue Icons &copy; <a href='http://www.pinvoke.com'>pinvoke</a> under Creative Commons licence.<br>";a+="Dictionary &copy; <a href='http://en.wiktionary.org'>Wiktionary</a> under Creative Commons licence.<br>";a+="<a href='http://famspam.com/facebox/'>Facebox</a> jQuery plugin &copy; Chris Wanstrath under MIT licence<br>";a+='Portions of the spelling engine &copy; <a href="http://brandonaaron.net">Brandon Aaron</a> under MIT licence.<br>';a+="Word prediction provided by <a href='http://www.aitype.com/'>AIType</a>.<br>";
a+="Text-to-Speech provided by <a href='http://www.acapela-group.com/'>Acapela Group</a>.";a+="</p>";b.setAbout(a);$lib.each(e,function(a,c){b.addPlugin(c)});b.addResetFn("reset-saved",function(){b.clearStorage();null!=typeof localStorage&&localStorage.removeItem("ATBarAutoLoad")});b.addCloseFn("close-saved",function(){null!=typeof localStorage&&localStorage.removeItem("ATBarAutoLoad")});b.render();$lib(".at-btn:first a").focus();null!=typeof localStorage&&localStorage.setItem("ATBarAutoLoad",1)})}
;

工具栏的完整javascript:

https://github.com/AccessAtECS/AtKit/blob/master/atkit/latest/atkit.js

上面代码中的javascript按钮之一调用了以下插件,该插件将包含在工具栏中。http://domain.com/services/jw3c/plugins/tts.js

按照上面的代码,工具栏出现在我网站的顶部,带有所有插件(javascript文件)。现在,我不希望工具栏调用自身。但是需要将这些工具栏插件的每一项都嵌入到下面的我的php文件中;

    <div id="samsc-<?php echo $module->id?>" class="samsc <?php echo $css; ?>">
    <div class="inner normal-msg">
        <?php echo $text; ?> 
//Need add javascript buttons here
        </div>
    <div class="buttons">
        <span class="icon-toogle opened"><?php echo JText::_('TOGGLE_BAR'); ?></span>
    </div>
</div>

任何提示,不胜感激。

理查德·B

您最好查看未缩小版本的代码,以了解其工作原理。这里似乎有一个:

https://github.com/AccessAtECS/AtKit/blob/master/atkit/latest/atkit.js

我以为您应该环顾第94行,因为“ position:fixed”就是将栏固定到页面顶部的原因。

第387行可能是我的猜测,它说它应该在打开的body标签旁边呈现html。

如果您不想直接编辑此代码,则在栏加载后使用css和javascript修改栏的显示可能会更简单(尽管比较笨重)。例如,在onload中,您可以剥离“ position:fixed”样式,并更改left和top值以匹配模块的left和top值。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章