Difference between revisions of "Template:USTC-Software/script"

(Created page with "window.USTC = {}; USTC.init = function() { USTC.load_css("style.css"); $("#top_menu_under").remove(); $("#content > h1").remove(); $("#bodyContent > p").remove...")
 
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
window.USTC = {};
 
window.USTC = {};
 
USTC.init = function() {
 
USTC.init = function() {
    USTC.load_css("style.css");
 
 
     $("#top_menu_under").remove();
 
     $("#top_menu_under").remove();
     $("#content > h1").remove();
+
     $("#firstHeading").remove();
     $("#bodyContent > p").remove();
+
     $("#mw-content-text > p").remove();
    $("#bodyContent div.printfooter").remove();
+
 
     $("#bodyContent div.visualClear").remove();
 
     $("#bodyContent div.visualClear").remove();
 
     USTC.load_css("//fonts.googleapis.com/css?family=Montserrat|Josefin+Sans");
 
     USTC.load_css("//fonts.googleapis.com/css?family=Montserrat|Josefin+Sans");
 +
    USTC.load_css_wiki("style");
 +
    USTC.load_favicon();
 
};
 
};
 
USTC.load_css = function(name) {
 
USTC.load_css = function(name) {
 
     var node = document.createElement("link");
 
     var node = document.createElement("link");
 
     node.rel = "stylesheet";
 
     node.rel = "stylesheet";
     node.href = "/Template:USTC-Software/" + name + "?action=raw&ctype=text/css";
+
     node.href = name;
 
     node.type = "text/css";
 
     node.type = "text/css";
 
     document.head.appendChild(node);
 
     document.head.appendChild(node);
 +
};
 +
USTC.load_css_wiki = function(name) {
 +
    USTC.load_css("/Template:USTC-Software/" + name + "?action=raw&ctype=text/css");
 +
};
 +
USTC.load_favicon = function() {
 +
    var node = document.createElement("link");
 +
    node.rel = "shortcut icon";
 +
    node.href = "/wiki/images/6/69/USTC-Software-Favicon.png";
 +
    document.head.appendChild(node);
 +
};
 +
USTC.Notebook = {};
 +
USTC.Notebook.hideBlocks = function(blocks, offset) {
 +
    blocks.each(function(){
 +
        ( $(this).offset().top > $(window).scrollTop()+$(window).height()*offset ) && $(this).find('.notebook-img, .notebook-content').addClass('is-hidden');
 +
    });
 +
};
 +
USTC.Notebook.showBlocks = function(blocks, offset) {
 +
    blocks.each(function(){
 +
        ( $(this).offset().top <= $(window).scrollTop()+$(window).height()*offset && $(this).find('.notebook-img').hasClass('is-hidden') ) && $(this).find('.notebook-img, .notebook-content').removeClass('is-hidden').addClass('bounce-in');
 +
    });
 
};
 
};
 
$(USTC.init);
 
$(USTC.init);

Latest revision as of 19:40, 18 September 2015

window.USTC = {}; USTC.init = function() {

   $("#top_menu_under").remove();
   $("#firstHeading").remove();
   $("#mw-content-text > p").remove();
   $("#bodyContent div.visualClear").remove();
   USTC.load_css("//fonts.googleapis.com/css?family=Montserrat|Josefin+Sans");
   USTC.load_css_wiki("style");
   USTC.load_favicon();

}; USTC.load_css = function(name) {

   var node = document.createElement("link");
   node.rel = "stylesheet";
   node.href = name;
   node.type = "text/css";
   document.head.appendChild(node);

}; USTC.load_css_wiki = function(name) {

   USTC.load_css("/Template:USTC-Software/" + name + "?action=raw&ctype=text/css");

}; USTC.load_favicon = function() {

   var node = document.createElement("link");
   node.rel = "shortcut icon";
   node.href = "/wiki/images/6/69/USTC-Software-Favicon.png";
   document.head.appendChild(node);

}; USTC.Notebook = {}; USTC.Notebook.hideBlocks = function(blocks, offset) {

   blocks.each(function(){
       ( $(this).offset().top > $(window).scrollTop()+$(window).height()*offset ) && $(this).find('.notebook-img, .notebook-content').addClass('is-hidden');
   });

}; USTC.Notebook.showBlocks = function(blocks, offset) {

   blocks.each(function(){
       ( $(this).offset().top <= $(window).scrollTop()+$(window).height()*offset && $(this).find('.notebook-img').hasClass('is-hidden') ) && $(this).find('.notebook-img, .notebook-content').removeClass('is-hidden').addClass('bounce-in');
   });

}; $(USTC.init);