我有一个Wordpress网站,最终是一个流式广播网站。在标头,我是从我的专用服务器的CP拉流数据(如听众数和当前播放)的脚本。(Centova演员)
我注册function.php脚本:
这是寄存器
wp_register_script(’streaminfo’, 'http://94.23.250.14:2199/system/streaminfo.js',false,null); wp_enqueue_script(’streaminfo’);
这是在整个jQuery的部分供您查看..
/* ------------------------------------
:: INITIATE JQUERY/STYLING
------------------------------------ */
function init_dynscripts() {
if (!is_admin()) {
if (function_exists('bp_is_blog_page')) {
if (!bp_is_blog_page()) {
wp_enqueue_script('bp-js', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/global.js', array('jquery'));
}
}
wp_register_style('northvantage-style', get_bloginfo('stylesheet_url'),false,null);
wp_enqueue_style('northvantage-style');
if(get_option('enable_responsive')!='disable') :
wp_register_style('northvantage-responsive', get_template_directory_uri().'/stylesheets/responsive.css',false,null);
wp_enqueue_style('northvantage-responsive');
endif;
wp_enqueue_script('jquery-ui-core',false,null);
wp_enqueue_script('jquery-ui-tabs',false,null);
wp_enqueue_script("jquery-ui-accordion",false,null);
wp_enqueue_script("swfobject",false,null);
wp_deregister_script("jquery-effects-core");
wp_deregister_script('libertas');
wp_register_script('libertas',get_template_directory_uri().'/js/nv-script.pack.js',false,null);
wp_enqueue_script('libertas');
wp_register_script(’streaminfo’, 'http://94.23.250.14:2199/system/streaminfo.js',false,null);
wp_enqueue_script(’streaminfo’);
wp_register_script(’jpie’, get_template_directory_uri().'/js/jpie.js',false,null);
wp_enqueue_script(’jpie’);
wp_register_style('jpiestyle', get_template_directory_uri().'/jpie.css',false,null);
wp_enqueue_style('jpiestyle');
if(get_option('jwplayer_js')) { // Check jw player javascript file is present
$NV_jwplayer_js = get_option('jwplayer_js');
wp_deregister_script('jw-player');
wp_register_script('jw-player', $NV_jwplayer_js,false,null);
wp_enqueue_script('jw-player');
}
}
}
add_action('init', 'init_dynscripts',100);
function _remove_script_version($src){ // remove script version
$parts = explode('?', $src);
return $parts[0];
}
add_filter('script_loader_src', '_remove_script_version', 15, 1);
add_filter('style_loader_src', '_remove_script_version', 15, 1);
看来我有streaminfo之间的冲突。 JS和我的网站。 元素检验得出:
Uncaught TypeError: Property '$' of object [object Window] is not a function
为了让事情short..everything我试图与文件结束了错。
我试着改变每个$符号到文件中的jQuery,它消除了冲突,但与其他文件产生冲突。
我尝试添加
jQuery(document).ready(function ($) {
到文件的头部,但它打破对CP的其他元素。
最终我跑了一个简单的测试,并创建了一个网页,只有这样的代码:
<html>
<body>
<span id="cc_strinfo_title_tranceilfm" class="cc_streaminfo"></span>
<script language="javascript" type="text/javascript" src="http://94.23.250.14:2199/system/streaminfo.js"></script>
</body>
</html>
和页面没有返回任何错误。 (我包括谷歌jQuery文件的路径)
在WordPress的东西搞乱了jQuery插件?或者我的代码中缺少一些字符串?
www.tranceil.fm
像这样? jQuery.noConflict(document).ready(function($){我应该如何关闭它?http://94.23.250.14:2199/system/streaminfo.js – Trance84 2012-08-01 17:15:18
像这样:jQuery(document).ready(function() {jQuery.noConflict();}); – 2012-08-01 17:17:21
Uncaught TypeError:无法调用null的方法'match':( – Trance84 2012-08-01 17:19:35