User:CBM2/jsMath/jsMath-easy-load.js

/*
 *  jsMath-easy-load.js
 *  
 *  Part of the jsMath package for mathematics on the web.
 *
 *  This file is used to load jsMath with one easy <SCRIPT>
 *  command in your HTML file.  It is called by the files
 *  in the jsMath/easy/ directory.  It expects that the jsMath.Easy
 *  array has been initialized before it is called.
 *
 *  ---------------------------------------------------------------------
 *
 *  Copyright 2007 by Davide P. Cervone
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

if (!window.jsMath) {window.jsMath = {}}
if (!jsMath.Easy) {jsMath.Easy = {}}
if (!jsMath.tex2math) {jsMath.tex2math = {}}

jsMath.tex2math.doubleDollarsAreInLine = jsMath.Easy.doubleDollarsAreInLine;
jsMath.tex2math.allowDisableTag = jsMath.Easy.allowDisableTag;

jsMath.safeHBoxes = jsMath.Easy.safeHBoxes;

if (jsMath.Easy.scale) {
  if (!jsMath.Controls) {jsMath.Controls = {}}
  if (!jsMath.Controls.cookie) {jsMath.Controls.cookie = {}}
  jsMath.Controls.cookie.scale = jsMath.Easy.scale;
}
if (!jsMath.Easy.allowDoubleClicks) {
  if (!jsMath.Click) {jsMath.Click = {}}
  jsMath.Click.CheckDblClick = function () {};
}
if (!jsMath.Easy.showFontWarnings) {
  if (!jsMath.Font) {jsMath.Font = {}}
  jsMath.Font.Message = function () {};
}

if (!jsMath.Easy.allowGlobal) {
  if (!jsMath.Controls) {jsMath.Controls = {}}
  if (!jsMath.Controls.cookie) {jsMath.Controls.cookie = {}}
  jsMath.Controls.cookie.global = 'never';
  jsMath.noGoGlobal = 1;
  jsMath.noChangeGlobal = 1;
  jsMath.noShowGlobal = 1;
}

if (jsMath.Easy.noImageFonts) {
  jsMath.noImgFonts = 1;
  if (!jsMath.Font) {jsMath.Font = {}}
  if (!jsMath.Font.message) {
    jsMath.Font.message =
      '<b>No jsMath TeX fonts found</b> -- using unicode fonts instead.<br/>\n'
        + 'This may be slow and might not print well.<br/>\n'
        + 'Use the jsMath control panel to get additional information.';
  }
  if (!jsMath.Fonts.extra_message) {
    jsMath.Font.extra_message =
      'Extra TeX fonts not found: <b><span id="jsMath_ExtraFonts"></span></b><br/>'
        + 'Using unicode fonts instead.  This may be slow and might not print well.<br/>\n'
        + 'Use the jsMath control panel to get additional information.';
  }
}

if (jsMath.Easy.processSingleDollars ||
    jsMath.Easy.processDoubleDollars ||
    jsMath.Easy.processSlashParens ||
    jsMath.Easy.processSlashBrackets ||
    jsMath.Easy.fixEscapedDollars) {

  jsMath.Easy.findCustomSettings = {
    processSingleDollars:     jsMath.Easy.processSingleDollars,
    processDoubleDollars:     jsMath.Easy.processDoubleDollars,
    processSlashParens:       jsMath.Easy.processSlashParens,
    processSlashBrackets:     jsMath.Easy.processSlashBrackets,
    processLaTeXenvironments: jsMath.Easy.processLaTeXenvironments,
    fixEscapedDollars:        jsMath.Easy.fixEscapedDollars,
    custom: 0
  }
}

if (!jsMath.Autoload) {jsMath.Autoload = {}}
jsMath.Autoload.root = jsMath.Easy.root+'/';

if (jsMath.Easy.autoload) {
  jsMath.Autoload.findTeXstrings = 0;
  jsMath.Autoload.findLaTeXstrings = 0;
  jsMath.Autoload.findCustomStrings = jsMath.Easy.customDelimiters;
  jsMath.Autoload.findCustomSettings = jsMath.Easy.findCustomSettings;
  jsMath.Autoload.loadFiles = jsMath.Easy.loadFiles;
  jsMath.Autoload.loadFonts = jsMath.Easy.loadFonts;
  jsMath.Autoload.macros = jsMath.Easy.macros;
  jsMath.Autoload.delayCheck = 1;
  jsMath.Easy.autoloadCheck = 1;
  document.write('<script src="'+jsMath.Autoload.root+'plugins/autoload.js"></script>');
  
} else {
  jsMath.Easy.tex2math =
     (jsMath.Easy.processSingleDollars ||
      jsMath.Easy.processDoubleDollars ||
      jsMath.Easy.processSlashParens ||
      jsMath.Easy.processSlashBrackets ||
      jsMath.Easy.processLaTeXenvironments ||
      jsMath.Easy.fixEscapedDollars ||
      jsMath.Easy.customDelimiters);

  if (!jsMath.Setup) {jsMath.Setup = {}}
  if (!jsMath.Setup.UserEvent) {jsMath.Setup.UserEvent = {}}
  jsMath.Setup.UserEvent.onload = function () {
    var easy = jsMath.Easy;
    if (easy.tex2math) jsMath.Setup.Script("plugins/tex2math.js");
    var i;
    if (easy.loadFiles) {
      for (i = 0; i < easy.loadFiles.length; i++)
        jsMath.Setup.Script(easy.loadFiles[i]);
    }
    if (easy.loadFonts) {
      for (i = 0; i < easy.loadFonts.length; i++)
        jsMath.Font.Load(easy.loadFonts[i]);
    }
    if (easy.macros) {
      for (i in easy.macros) {
        if (typeof(easy.macros[i]) == 'string') {
          jsMath.Macro(i,easy.macros[i]);
        } else {
          jsMath.Macro(i,easy.macros[i][0],easy.macros[i][1]);
        }
      }
    }
  }
  document.write('<script src="'+jsMath.Easy.root+'/jsMath.js"></script>'+"\n");
}

jsMath.Easy.onload = function () {
  if (jsMath.Easy.loaded) {return} else {jsMath.Easy.loaded = 1}
  if (jsMath.Easy.autoloadCheck) jsMath.Autoload.Check();
  if (jsMath.Easy.tex2math) {
    jsMath.Synchronize(function () {
      if (jsMath.Easy.findCustomSettings)
        jsMath.tex2math.Convert(document,jsMath.Easy.findCustomSettings);
      if (jsMath.Easy.customDelimiters) {
        var s = jsMath.Easy.customDelimiters;
        jsMath.tex2math.CustomSearch(s[0],s[1],s[2],s[3]);
        jsMath.tex2math.ConvertCustom();
      }
    });
  }
  (jsMath[jsMath.Easy.method])();
}

if (window.addEventListener) {window.addEventListener("load",jsMath.Easy.onload,false)}
else if (window.attachEvent) {window.attachEvent("onload",jsMath.Easy.onload)}
else {window.onload = jsMath.Easy.onload}

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.