MediaWiki:Common.js

From CTLTMS
Revision as of 10:37, 28 February 2017 by Anw (talk | contribs)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */

    mwCustomEditButtons.push({
        "imageFile": "images/Button_enter.png",
        "speedTip": "Line break",
        "tagOpen": "<br />",
        "tagClose": "",
        "sampleText": ""
    });
 
    mwCustomEditButtons.push({
        "imageFile": "images/Button_upper_letter.png",
        "speedTip": "Superscript",
        "tagOpen": "<sup>",
        "tagClose": "</sup>",
        "sampleText": "Superscript text"
    });
 
    mwCustomEditButtons.push({
        "imageFile": "images/Button_small.png",
        "speedTip": "Small",
        "tagOpen": "<small>",
        "tagClose": "</small>",
        "sampleText": "Small Text"
    });

    mwCustomEditButtons.push({
        "imageFile": "images/Button_gallery.png",
        "speedTip": "Insert a picture gallery",
        "tagOpen": "\n<gallery widths=600px heights=350px perrow=1>\n",
        "tagClose": "\n</gallery>",
        "sampleText": "Image:CTLTMS_Example1.PNG|''Caption1''\nImage:CTLTMS_Example2.PNG|''Caption2''"
    });

    var today = new Date();
    var monthNames = ["January", "February", "March", "April", "May", "June",
      "July", "August", "September", "October", "November", "December"
    ];
    var stndrdth = ["th","st","nd","rd","th","th","th","th","th","th"];
    var dayth = today.getDate() % 10;
    mwCustomEditButtons.push({
        "imageFile": "images/Button_CoverPage.png",
        "speedTip": "Insert an Document Title Page",
        "tagOpen": "{{Doc_Title\n|Client=ClientName\n|System=''CALIDUS'' System\n|Title=Doc Title\n|Reference=Document type and Supimix reference\n|Version=0.1\n|Date="+today.getDate()+stndrdth[dayth]+" "+monthNames[today.getMonth()]+" "+today.getFullYear()+"\n|Year="+today.getFullYear()+"\n}}\n",
        "tagClose": "",
        "sampleText": ""
    });

    mwCustomEditButtons.push({
        "imageFile": "images/Button_LastPage.png",
        "speedTip": "Insert an Document Final Page",
        "tagOpen": "{{Doc_Appendix|\nAppendix=The Appendix Section. Defaults to A\n|Glossary=WCS|WMS|CTMS. Omit if no glossary is to be included.\n|Ref1=First reference document title. There can be up to 5 (Ref2, Ref3, etc). Omit those you do not want to use.\n|RefV1=First reference document version\n|RefDate1=First reference document date\n|Rev1=Authorising Name. Up to 3 may be specified (Rev2, Rev3)\n|Rev1Title=Job Title\n",
        "tagClose": "\n}}\n",
        "sampleText": "<!-- The following may also be added -->\n|Estimate=Enter Y if an estimate section is to be included. Use the following fields for the values. If the values are omitted, they default to Zero. Also include Client and Year for the correct rates.\n|REQ=Requirements Time\n|EST=Estimate Time\n|FS=Functional Specification Time\n|TS=Technical Specification Time\n|DEV=Development Time\n|ST=Testing Time\n|IMP=Implementation Time\n|Client=Client for estimate rates\n|Year=Year for estimate rates"
    });

    mwCustomEditButtons.push({
        "imageFile": "images/Button_insert_table.png",
        "speedTip": "Insert a table",
        "tagOpen": '{| class="wikitable" border="1"\n|- bgcolor="silver"\n',
        "tagClose": "\n|}\n",
        "sampleText": "! header1 !! header2 !! header3\n|-\n| cell1 || cell2 || cell3"
    });


    mwCustomEditButtons.push({
        "imageFile": "images/Button_comment.png",
        "speedTip": "Insert a comment",
        "tagOpen": '{{comment|text=',
        "tagClose": "\n|sign=[[User:"+wgUserName+"]]|date="+today.getDate()+"/"+(today.getMonth()+1)+"/"+today.getFullYear()+" "+today.getHours()+":"+today.getMinutes()+":"+today.getSeconds()+"}}\n",
        "sampleText": "Your Comment Here"
    });


window.onscroll = function (e) {
  var vertical_position = 0;
  if (pageYOffset)//usual
    vertical_position = pageYOffset;
  else if (document.documentElement.clientHeight)//ie
    vertical_position = document.documentElement.scrollTop;
  else if (document.body)//ie quirks
    vertical_position = document.body.scrollTop;

  console.log(vertical_position);

  var divHead = document.getElementById('mw-head');
  var divMenu = document.getElementById('mw-panel');
  divHead.top = (vertical_position) + 'px';
  divMenu.top = (vertical_position + 160) + 'px';
  console.log(divHead.top);
  console.log(divMenu.top);
}