Subversion Repositories pub

Compare Revisions

Ignore whitespace Rev 105 → Rev 106

/wp-js-syntax-highlighter/trunk/loader.full.js
53,7 → 53,10
}
$(document).ready(function() { shLoader.load(); });
}, // }}} // init()
load: function() { // {{{
/** {{{ // load() Actually load SyntaxHighlighter, if required
* Only if some code block is found it will be loaded.
*/
load: function() {
if (!jQuery) { return; }
var cssPath = this.path+'/sh/styles';
var jsPath = this.path+'/sh/scripts';
76,10 → 79,17
$.ajax({ // Like jQuery.getScript() but in synchronous mode
url: jsPath+'/shCore.js',
dataType: 'script',
async: false
async: false, // If loaded asynchronously sh fails. Why? No clue.
success: shLoader.apply,
});
}, // }}} // load()
apply: function() { // Initialise the SyntaxHighlighter plugin
if ('undefined' == typeof(SyntaxHighlighter)) {
// Something failed...
return;
}
 
$(this.loadURLs).each(function (i,e) {
$(shLoader.loadURLs).each(function (i,e) {
$.ajax({
url: e,
dataType: 'script',
86,12 → 96,6
async: false,
});
});
 
if ('undefined' == typeof(SyntaxHighlighter)) {
// Something failed...
return;
}
 
// Set any configuration and defaults
for (var prop in this.configObj) {
SyntaxHighlighter.config[prop] = this.configObj[prop];
100,9 → 104,9
SyntaxHighlighter.defaults[prop] = this.defaultsObj[prop];
}
 
// FIXME: It won't load sometimes. Why?
// FIXME: This used to fail on first load, it seems to fail from time to time now
SyntaxHighlighter.all(); // Actually apply syntax highlighting
}, // }}} // load()
}, // }}} // apply()
/** {{{ // setDefaults() // Sets the defaults object of SyntaxHighlighter
* Note the defaults won't be applied until init() is called and SyntaxHighlighter
* loaded.
124,8 → 128,9
}, // }}} // setConfig
detectLanguages: function() { // {{{ // Find any language used in the page
var detected = [];
var re = /brush: (\w+)/i;
$('.brush\\:').each(function() {
var re = /brush: ?(\w+)/i;
//$('.brush\\:') would not match stuff like 'brush:css' (but it will match 'brush: css')
$('[class^=brush:]').each(function() {
var cn = $(this).attr('class');
var lang = cn.match(re)[1];
shLoader.reqLoad(lang);