Difference between revisions of "Team:OUC-China/js/jquery.oucext.js"

(Created page with "// This file adds external functions to jQuery 2.1.4. // All codes are licensed to WinUP Software and you have no permission to use it only if for acedemic researches. // Make su...")
 
(Blanked the page)
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
// This file adds external functions to jQuery 2.1.4.
 
// All codes are licensed to WinUP Software and you have no permission to use it only if for acedemic researches.
 
// Make sure that you imported this file after markdown.js if you want to use $.createElement.
 
(function ($) {
 
    $.getUrlParam = function (name) {
 
        var r = window.location.search.substr(1).match(new RegExp("(^|&)" + name + "=([^&]*)(&|$)"));
 
        if (r != null) return unescape(r[2]);
 
        return null;
 
    }
 
})(jQuery);
 
  
(function ($) {
 
    $.createElement = function (content) {
 
        var converter = new Markdown.Converter();
 
        var parts = content.split('exec::split');
 
        for (var i = 0; i < parts.length; i++) {
 
            var html = converter.makeHtml(parts[i]);
 
            parts[i] = html;
 
            if (i % 2 == 0) parts[i] = '<div class="container">' + parts[i] + '</div>';
 
            else parts[i] = '<div class="bg-gray"><div class="container">' + parts[i] + '</div></div>';
 
        }
 
        return parts.join('');
 
    }
 
})(jQuery);
 

Latest revision as of 05:23, 16 September 2015