Reputation: 195
Can someone please help me sort out a few errors from some javascript functions: I'll point which function, error with the link of the script written in fiddle.These functions are working perfectly but those errors came up in web developers tool.
(1) calling Flexslider js, this is the function:
ERROR : Uncaught ReferenceError: SyntaxHighlighter is not defined
<script type="text/javascript">
$(function(){
SyntaxHighlighter.all(); <----- ERROR
});
$(window).load(function(){
$('.flexslider').flexslider({
animation: "slide",
start: function(slider){
$('body').removeClass('loading');
}
});
});
</script>
(2) ERROR - This script is to disable the right button. the entire script can be seen here : http://jsfiddle.net/DQ6EX/
captureEvents() is deprecated. This method doesn't do anything.
(3) ERROR - event.returnValue is deprecated. Please use the standard event.preventDefault() instead.
Line 3345
http://code.jquery.com/jquery-1.9.1.js
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
Upvotes: 1
Views: 1136
Reputation: 5836
To answer #(1)
You have to use the autoloader like it says in the demo page http://alexgorbatchev.com/SyntaxHighlighter/manual/demo/
You don't have to use all the stuff only which code you want to format.
For each of those formats you need a specific javascript file which starts like shXXX.js
function path()
{
var args = arguments,
result = []
;
for(var i = 0; i < args.length; i++)
result.push(args[i].replace('@', '/pub/sh/current/scripts/'));
return result
};
SyntaxHighlighter.autoloader.apply(null, path(
'applescript @shBrushAppleScript.js',
'actionscript3 as3 @shBrushAS3.js',
'bash shell @shBrushBash.js',
'coldfusion cf @shBrushColdFusion.js',
'cpp c @shBrushCpp.js',
'c# c-sharp csharp @shBrushCSharp.js',
'css @shBrushCss.js',
'delphi pascal @shBrushDelphi.js',
'diff patch pas @shBrushDiff.js',
'erl erlang @shBrushErlang.js',
'groovy @shBrushGroovy.js',
'java @shBrushJava.js',
'jfx javafx @shBrushJavaFX.js',
'js jscript javascript @shBrushJScript.js',
'perl pl @shBrushPerl.js',
'php @shBrushPhp.js',
'text plain @shBrushPlain.js',
'py python @shBrushPython.js',
'powershell ps posh @shBrushPowerShell.js',
'ruby rails ror rb @shBrushRuby.js',
'sass scss @shBrushSass.js',
'scala @shBrushScala.js',
'sql @shBrushSql.js',
'vb vbnet @shBrushVb.js',
'xml xhtml xslt html @shBrushXml.js'
));
SyntaxHighlighter.all();
To answer #(2)
The deprecated warning about captureEvents() is just so it works for older Netscape Browsers I wouldn't worry about it, just a warning after all.
This actually works right, just when putting stuff in jsfiddle don't use <script>
</script>
tags it does those for you automatically.
Plus you should probably be using <script type="text/javascript">...</script>
, it even tells you not to use them when you try to use this error in yellow
Input plain JavaScript code, no HTML.
var isNS = (navigator.appName == "Netscape") ? 1 : 0;
if(navigator.appName == "Netscape") document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);
function mischandler(){
return false;
}
function mousehandler(e){
var myevent = (isNS) ? e : event;
var eventbutton = (isNS) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
Upvotes: 1