Forum:How to make 《 and 》 bold permanently

I want to Chinese characters 《 and 》 bold permanently. They indicate books or historical writings so I find it helpfull to have them stand out a bit more among all the other Chinese characters. How can I make them bold permanently? --- Zantam03 ( Talk ) 13:04, April 1, 2012 (UTC)


 * You can try using an external script by adding the code to your MediaWiki:Common.js. The code to add would be:

 /* * jQuery Highlight plugin * * Based on highlight v3 by Johann Burkard * http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html * * Code a little bit refactored and cleaned (in my humble opinion). * Most important changes: * - has an option to highlight only entire words (wordsOnly - false by default), * - has an option to be case sensitive (caseSensitive - false by default) * - highlight element tag and class names can be specified in options * * Usage: *  // wrap every occurrance of text 'lorem' in content *  // with (default options) *  $('#content').highlight('lorem'); * *  // search for and highlight more terms at once *  // so you can save some time on traversing DOM *  $('#content').highlight(['lorem', 'ipsum']); *  $('#content').highlight('lorem ipsum'); * *  // search only for entire word 'lorem' *  $('#content').highlight('lorem', { wordsOnly: true }); * *  // don't ignore case during search of term 'lorem' *  $('#content').highlight('lorem', { caseSensitive: true }); * *  // wrap every occurrance of term 'ipsum' in content *  // with  *  $('#content').highlight('ipsum', { element: 'em', className: 'important' }); * *  // remove default highlight *  $('#content').unhighlight; * *  // remove custom highlight *  $('#content').unhighlight({ element: 'em', className: 'important' }); * * * Copyright (c) 2009 Bartek Szopka * * Licensed under MIT license. * */ $(document).ready(function { jQuery.extend({ highlight: function (node, re, nodeName, className) { if (node.nodeType === 3) { var match = node.data.match(re); if (match) { var highlight = document.createElement(nodeName || 'span'); highlight.className = className || 'highlight'; var wordNode = node.splitText(match.index); wordNode.splitText(match[0].length); var wordClone = wordNode.cloneNode(true); highlight.appendChild(wordClone); wordNode.parentNode.replaceChild(highlight, wordNode); return 1; //skip added node in parent }       } else if ((node.nodeType === 1 && node.childNodes) && // only element nodes that have children                !/(script|style)/i.test(node.tagName) && // ignore script and style nodes                !(node.tagName === nodeName.toUpperCase && node.className === className)) { // skip if already highlighted for (var i = 0; i < node.childNodes.length; i++) { i += jQuery.highlight(node.childNodes[i], re, nodeName, className); }       }        return 0; } }); jQuery.fn.unhighlight = function (options) {   var settings = { className: 'highlight', element: 'span' };    jQuery.extend(settings, options);    return this.find(settings.element + "." + settings.className).each(function { var parent = this.parentNode; parent.replaceChild(this.firstChild, this); parent.normalize; }).end; }; jQuery.fn.highlight = function (words, options) {   var settings = { className: 'highlight', element: 'span', caseSensitive: false, wordsOnly: false };    jQuery.extend(settings, options);    if (words.constructor === String) {        words = [words];    }    words = jQuery.grep(words, function(word, i){ return word != ''; });   words = jQuery.map(words, function(word, i) { return word.replace(/[-[\]{}*+?.,\\^$|#\s]/g, "\\$&"); });   if (words.length == 0) { return this; };    var flag = settings.caseSensitive ? "" : "i";    var pattern = "(" + words.join("|") + ")";    if (settings.wordsOnly) {        pattern = "\\b" + pattern + "\\b";    }    var re = new RegExp(pattern, flag);    return this.each(function  { jQuery.highlight(this, re, settings.element, settings.className); }); }; $('body').highlight('《'); $('body').highlight('》'); $('.highlight').css({ 'font-weight': 'bold' }); });
 * Although intuition tells me there's probably an easier way to do this. — Sovq 16:56, April 1, 2012 (UTC)


 * I hope so :-D If you don't mind I think I'll wait a bit for further replies ;-) --- Zantam03 ( Talk ) 18:45, April 1, 2012 (UTC)


 * Add this to your MediaWiki:Common.js on the wiki.


 * Rappy 19:55, April 1, 2012 (UTC)


 * Thanks :-) --- Zantam03 ( Talk ) 19:59, April 1, 2012 (UTC)


 * Simplified. Rappy 20:08, April 1, 2012 (UTC)


 * Sorry, but you can't simply replace the contents of an entire section of HTML of the page and then reassign the modified HTML to it. That completely destroys all the JS events of inner elements, and makes all JavaScript included inside that HTML to be executed again, and "document.write" that Wikia use in their code would cause a blank page. That, and also huge memory leaks. If you want them to be bold I suggest you use a bot to do that replace on the wiki markup and not on the generated HTML. --Category:Ciencia Al Poder (talk) -WikiDex 21:00, April 1, 2012 (UTC)

That would explain why Sovq's JS above was so complicated. I have never used .replace in this manner and was unaware of that. Personally, I think I'd just make a template for it. Template:( and Template:) for example. Rappy 21:06, April 1, 2012 (UTC)


 * But there are 65 pages in total like this one that are going to make use of it. Using a template for it would be a lot of work. Is Sovq's code not a safe one then? I'm using Rappy's code right now and haven't run into any errors yet. What kind of errors could I expect in the future? --- Zantam03 ( Talk ) 10:14, April 2, 2012 (UTC)