ラベル Drawing Shapes の投稿を表示しています。 すべての投稿を表示
ラベル Drawing Shapes の投稿を表示しています。 すべての投稿を表示

2016年10月31日月曜日

2 - ol3.19ex 161b - Draw Shapes 2

「draw-shapes.js(2161-ol3ex.js)」は、マップを表示するための JavaScript ファイルです。

「2161-ol3ex.js」
var raster = new ol.layer.Tile({
/** ol.layer.Tile 
 * For layer sources that provide pre-rendered, tiled 
 * images in grids that are organized by zoom levels 
 * for specific resolutions. 
 * プリレンダリング(事前描画)を提供するレイヤソースのため
 * の、特定の解像度でのズームレベルによって編成されているグ
 * リッドのタイルイメージ。(ol3 API)
 */
 source: new ol.source.OSM()
 /** ol.source.OSM 
  * Layer source for the OpenStreetMap tile server.
  * OpenStreetMap タイルサーバのレイヤソース。(ol3 API)
  */
});
var source = new ol.source.Vector({wrapX: false});
/** ol.source.Vector
 * Provides a source of features for vector layers. 
 * Vector features provided by this source are 
 * suitable for editing. See ol.source.VectorTile for 
 * vector data that is optimized for rendering.
 * ベクタレイヤのフィーチャのソースを用意します。このソース
 * が提供するベクタフィーチャは、編集に適しています。レンダ
 * リングのために最適化されたベクタデータの 
 * ol.source.VectorTile を参照してください。(ol3 API)
 */
/** wrapX:
 * Wrap the world horizontally. Default is true. For 
 * vector editing across the -180° and 180° meridians 
 * to work properly, this should be set to false. The 
 * resulting geometry coordinates will then exceed the 
 * world bounds.
 * 水平方向に世界をラップします。デフォルトは true。-180°
 * と180°の子午線を横切って編集するベクトルが正しく動作す
 * るために、これは false に設定する必要があります。ジオメ
 * トリの座標の結果は、その後、世界の境界線を超えます。
 * (ol3 API[説明は Stable Only のチェックを外すと表示])
 */
var vector = new ol.layer.Vector({
/** ol.layer.Vector
 * Vector data that is rendered client-side.
 * クライアント側で描画されるベクタデータ。(ol3 API)
 */
 source: source
});
var map = new ol.Map({
 layers: [raster, vector],
 target: 'map',
 view: new ol.View({
  center: [-11000000, 4600000],
  zoom: 4
 })
});
var typeSelect = document.getElementById('type');
var draw; 
// global so we can remove it later
// グローバル、私たちは、後でそれを削除することができます
function addInteraction() {
 var value = typeSelect.value;
 if (value !== 'None') {
  var geometryFunction;
  if (value === 'Square') {
   value = 'Circle';
   geometryFunction = ol.interaction.Draw.createRegularPolygon(4);
   /** ol.interaction.Draw.createRegularPolygon(opt_sides, opt_angle)
    * Create a geometryFunction for type: 'Circle' that 
    * will create a regular polygon with a user specified 
    * number of sides and start angle instead of an 
    * ol.geom.Circle geometry.
    * ol.geom.Circle ジオメトリの代わりにユーザーが指定した
    * 辺の数の正多角形を作成し、角度を開始しする
    * 「type: 'Circle'」の geometryFunction を作成します。
    * (ol3 API[説明は Stable Only のチェックを外すと表示])
    */
  } else if (value === 'Box') {
   value = 'Circle';
   geometryFunction = ol.interaction.Draw.createBox();
   /** ol.interaction.Draw.createBox()
    * Create a geometryFunction that will create a 
    * box-shaped polygon (aligned with the coordinate 
    *  system axes). Use this with the draw interaction 
    * and type: 'Circle' to return a box instead of a 
    * circle geometry.
    * (座標系の軸で位置合わせされる)ボックス状のポリゴンで 
    * geometryFunction を作成します。サークルジオメトリの替
    * りにボックスを返すために、ドローインタラクションと
    * 「type: 'Circle'」して使用してください。
    * (ol3 API[説明は Stable Only のチェックを外すと表示])
    */
  } else if (value === 'Star') {
   value = 'Circle';
   geometryFunction = function(coordinates, geometry) {
    if (!geometry) {
     geometry = new ol.geom.Polygon(null);
     /** ol.geom.Polygon
      * Polygon geometry.(ol3 API)
      */
    }
    var center = coordinates[0];
    var last = coordinates[1];
    var dx = center[0] - last[0];
    var dy = center[1] - last[1];
    var radius = Math.sqrt(dx * dx + dy * dy);
    /** Math.sqrt()
      * 引数として与えた数の平方根を返します。
      * (MDN[https://developer.mozilla.org/ja/docs/Web/
      * JavaScript/Reference/Global_Objects/Math/sqrt])
      */
    var rotation = Math.atan2(dy, dx);
    /** Math.atan2()
      * 引数の比率でのアークタンジェントを返します。
      * (MDN[https://developer.mozilla.org/ja/docs/Web/
      * JavaScript/Reference/Global_Objects/Math/atan2])
      */
    var newCoordinates = [];
    var numPoints = 12;
    for (var i = 0; i < numPoints; ++i) {
     var angle = rotation + i * 2 * Math.PI / numPoints;
     /** Math.PI()
       * 円周率。約 3.14159 です。
      * (MDN[https://developer.mozilla.org/ja/docs/Web
      * /JavaScript/Reference/Global_Objects/Math/PI])
      */
     var fraction = i % 2 === 0 ? 1 : 0.5;
     /** %(剰余)
      * 剰余演算子は1つ目の数値を2つ目の数値で割った余りを返し
      * ます。
      * (MDN[https://developer.mozilla.org/ja/docs/Web/
      * JavaScript/Reference/Operators/
      * Arithmetic_Operators#Remainder])
      */
     /** ===(厳密に等しい)
      * 厳密等価演算子はオペランド同士が、型を変換することなく
      * 厳密に等しいならば真を返します。
      * (MDN[https://developer.mozilla.org/ja/docs/Web/
      * JavaScript/Reference/Operators/
      * Comparison_Operators#Identity])
      */
     var offsetX = radius * fraction * Math.cos(angle);
     /** Math.cos()
      * 引数として与えた数のコサインを返します。
      * (MDN[https://developer.mozilla.org/ja/docs/Web/
      * JavaScript/Reference/Global_Objects/Math/cos])
      */
     var offsetY = radius * fraction * Math.sin(angle);
     /** Math.sin()
      * 引数として与えた数のサイン(正弦)を返します。
      * (MDN[https://developer.mozilla.org/ja/docs/Web/
      * JavaScript/Reference/Global_Objects/Math/sin])
      */
     newCoordinates.push([center[0] + offsetX, center[1] + offsetY]);
     /** push(elem)
      * Insert the provided element at the end of the 
      * collection.
      * コレクションの最後に供給されたエレメントに挿入します。
      * Name: elem, Type: T, Description: Element
      * (ol3 API)
      */
    }
    newCoordinates.push(newCoordinates[0].slice());
    /** Array.prototype.slice()
     * The slice() method returns a shallow copy of a 
     * portionof an array into a new array object.
     * slice()メソッドは、配列の一部の簡易コピーを新しい配列オ
     * ブジェクトに返します。
     * (MDN[https://developer.mozilla.org/ja/docs/Web/
     * JavaScript/Reference/Global_Objects/Array/slice])
     */
    geometry.setCoordinates([newCoordinates]);
    /** setCoordinates()
     * setCoordinates(coordinates) [Type: ol.Coordinate, 
     * Description: Coordinates](ol3 API)
     */
    return geometry;
   };
  }
  draw = new ol.interaction.Draw({
  /** ol.interaction.Draw 
   * Interaction that allows drawing geometries.
   * ジオメトリの描画を認めるインターラクション。(ol3 API)
   */
   source: source,
   /** source
    * Destination source for the drawn features.
    * 描画されたフィーチャのための宛先ソース。
    * (ol3 API[説明は Stable Only のチェックを外すと表示])
    */
   type: /** @type {ol.geom.GeometryType} */ (value),
   /** type
    * Drawing type ('Point', 'LineString', 'Polygon', 
    * 'MultiPoint', 'MultiLineString', 'MultiPolygon' 
    * or 'Circle'). Required.
    * タイプ(「ポイント」、 「ラインストリング」、「ポリゴン」、
    * 「マルチポイント」、「マルチラインストリング」、 「マルチ
    * ポリゴン'」または「'サークル」)を描画します。 必須。
    * (ol3 API[説明は Stable Only のチェックを外すと表示])
    */
   /** @type 
    * 値のタイプ(型)の説明 - 式などで表示
    * (@use JSDoc[http://usejsdoc.org/]より)
    */
   geometryFunction: geometryFunction
   /** geometryFunction
    * Function that is called when a geometry's coordinates 
    * are updated.
    * ジオメトリの座標が更新されるとき、予備だ荒れる関数です。
    * (ol3 API[説明は Stable Only のチェックを外すと表示])
    */
  });
  map.addInteraction(draw);
  /** addInteraction(interaction)
   * Add the given interaction to the map.
   * マップへ指定されたインターラクションを追加します。
   * (ol3 API)
   */
 }
}
/**
 * Handle change event.
 * 変更イベントを処理します。
 */
typeSelect.onchange = function() {
/** GlobalEventHandlers.onchange()
 * The onchange property sets and returns the event handler 
 * for the change event.
 * onchange プロパティは、change イベントに対してイベントハ
 * ンドラを設定、および、返します。
 * (MDN[https://developer.mozilla.org/en-US/docs/Web/
 * API/GlobalEventHandlers/onchange])
 */
 map.removeInteraction(draw);
 /** removeInteraction(()
  * Remove the given interaction from the map.
  * マップから指定されたインターラクションを削除します。
  * (ol3 API)
  */
 addInteraction();
};
addInteraction();
 
 

2 - ol3.19ex 161a - Draw Shapes 1

「Draw Shapes(draw-shapes.html)」を参考に地図を表示してみます。説明に次のようにあります。

This demonstrates the use of the geometryFunction option for the ol.interaction.Draw. Select a shape type from the dropdown above to start drawing. To activate freehand drawing, hold the Shift key. Square drawing is achieved by using type: 'Circle' type with a geometryFunction that creates a 4-sided regular polygon instead of a circle. Box drawing uses type: 'Circle' with a geometryFunction that creates a box-shaped polygon instead of a circle. Star drawing uses a custom geometry function that coverts a circle into a start using the center and radius provided by the draw interaction.

これは ol.interaction.Draw の geometryFunction オプションの使用方法を示します。描画を開始するには、上記のドロップダウンから形状の種類を選択します。フリーハンド描画を有効にするには、Shiftキーを押したままにします。Square(正多角形)描画は、circle(円)の代わりに4辺の正多角形を作成する geometryFunction で「type: 'Circle'」を使用することによって達成されます。Box(ボックス)描画は、circle(円)の代わりにボックス型ポリゴンを作成する geometryFunction で「type: 'Circle'」を使用します。Star(星)描画は、draw インターラクションによって提供される中心と半径を使用して、開始に円を変換するカスタムジオメトリ関数を使用しています。


HTML ファイルの作成
a Eclipse のメニューの「ファイル」->「ファイルを開く」をクリックします。






b 「ファイルを開く」ウィンドウで、「user」->「mapsite」->「ol3proj」->「v3.19.1」->「examples」->「draw-shapes.html」をクリックして選択し、「OK」ボタンをクリックします。
同じように「draw-shapes.js」を開きます。





c メニューの「ファイル」->「新規」 -> 「ファイル」をクリックします。




d 「ファイル」ウィンドウで「ol3proj」をクリックして選択し、「ファイル名」を「2161-ol3ex.html」と入力し、「次へ」ボタンをクリックします。








e 「File Template」ウィンドウで「HTML 5 Template」をクリックして選択し、「OK」ボタンをクリックします。











f 「draw-shapes.html」の内容をコピーして「2161-ol3ex.html」に貼り付け、修正します。
g 同じように、新規に「2161-ol3ex.js」ファイルを作成し、「File Template」ウィンドウで「JavaScript Template」をクリックして選択し、「完了」ボタンをクリックして、「draw-shapes.js」の内容をコピーして貼り付け、修正します。「draw-shapes-require.js」も「2161-ol3ex-require.js」に貼り付けます。

「2161-ol3ex.html」
<!doctype html>
<html lang="en-US">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" type="text/css">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-combined.min.css" type="text/css">
  <!--
  <link rel="stylesheet" href="../css/ol.css" type="text/css">
  <link rel="stylesheet" href="./resources/layout.css" type="text/css">

  <link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
  <script src="./resources/zeroclipboard/ZeroClipboard.min.js"></script>
  -->
  <!-- ディレクトリ修正 -->
  <link rel="stylesheet" href="v3.19.1/css/ol.css" type="text/css">
  <link rel="stylesheet" href="v3.19.1/examples/resources/layout.css" type="text/css">

  <link rel="stylesheet" href="v3.19.1/examples/resources/prism/prism.css" type="text/css">
  <script src="v3.19.1/examples/resources/zeroclipboard/ZeroClipboard.min.js"></script>
  <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=fetch"></script>
  <title>Freehand Drawing</title>
 </head>
 <body>
  <!-- 
  bootstrap-combined.min.css, ol.css, layout.css,
  CSSファイルで設定されたセレクタを使用。
  -->
  <header class="navbar" role="navigation">
   <div class="container">
    <div class="display-table pull-left" id="navbar-logo-container">
    <!--
    <a class="navbar-brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers Examples</a>
    -->
    <!-- ディレクトリ修正 -->
    <a class="navbar-brand" href="v3.19.1/examples/"><img src="v3.19.1/examples/resources/logo-70x70.png"> OpenLayers Examples</a>
    <!-- menu items that get hidden below 768px width -->
    <nav class='collapse navbar-collapse navbar-responsive-collapse'>
     <ul class="nav navbar-nav pull-right">
      <!-- <li><a href="../doc">Docs</a></li> -->
      <li><a href="v3.19.1/doc">Docs</a></li>
      <li><a class="active" href="index.html">Examples</a></li>
      <!-- <li><a href="../apidoc">Docs</a></li> -->
      <li><a href="v3.19.1/apidoc">API</a></li>
      <li><a href="https://github.com/openlayers/ol3">Code</a></li>
     </ul>
    </nav>
   </div>
  </header>
  <div class="container-fluid">
   <div id="latest-check" class="alert alert-warning alert-dismissible" role="alert" style="display:none">
    <button id="latest-dismiss" type="button" class="close" data-dismiss="alert" aria-label="Close">
     <span aria-hidden="true">&times;</span>
    </button>
     This example uses OpenLayers v<span>3.19.1</span>. 
     The <a id="latest-link" href="#" class="alert-link">latest</a>
     is v<span id="latest-version"></span>.
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <h4 id="title">Draw Shapes</h4>
     <div id="map" class="map"></div>
     <form class="form-inline">
      <label>Shape type &nbsp;</label>
      <select id="type">
       <option value="Square">Square</option>
       <option value="Box">Box</option>
       <option value="Star">Star</option>
       <option value="None">None</option>
      </select>
     </form>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <p id="shortdesc">Example using the ol.interaction.Draw 
      interaction in freehand mode.</p>
     <div id="docs"><p>This demonstrates the use of the 
      <code>geometryFunction</code> option for the 
      <code>ol.interaction.Draw</code>. Select a shape type from 
      the dropdown above to start drawing. To activate freehand 
      drawing, hold the <code>Shift</code> key. Square drawing 
      is achieved by using <code>type: 'Circle'</code> 
      type with a <code>geometryFunction</code> that creates a 
      4-sided regular polygon instead of a circle. Box drawing 
      uses <code>type: 'Circle'</code> with a 
      <code>geometryFunction</code> that creates a box-shaped 
      polygon instead of a circle.  Star drawing uses a custom 
      geometry function that coverts a circle into a start using 
      the center and radius provided by the draw interaction.</p>
     </div>
     <div id="api-links">Related API documentation: 
      <ul class="inline">
       <li>
        <!-- <a href="../apidoc/ol.Map.html" title="API documentation for ol.Map">ol.Map</a> -->
        <a href="v3.19.1/apidoc/ol.Map.html" title="API documentation for ol.Map">ol.Map</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a> -->
        <a href="v3.19.1/apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.geom.Polygon.html" title="API documentation for ol.geom.Polygon">ol.geom.Polygon</a> -->
        <a href="v3.19.1/apidoc/ol.geom.Polygon.html" title="API documentation for ol.geom.Polygon">ol.geom.Polygon</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.interaction.Draw.html" title="API documentation for ol.interaction.Draw">ol.interaction.Draw</a> -->
        <a href="v3.19.1/apidoc/ol.interaction.Draw.html" title="API documentation for ol.interaction.Draw">ol.interaction.Draw</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.layer.Tile.html" title="API documentation for ol.layer.Tile">ol.layer.Tile</a> -->
        <a href="v3.19.1/apidoc/ol.layer.Tile.html" title="API documentation for ol.layer.Tile">ol.layer.Tile</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.layer.Vector.html" title="API documentation for ol.layer.Vector">ol.layer.Vector</a> -->
        <a href="v3.19.1/apidoc/ol.layer.Vector.html" title="API documentation for ol.layer.Vector">ol.layer.Vector</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.source.OSM.html" title="API documentation for ol.source.OSM">ol.source.OSM</a> -->
        <a href="v3.19.1/apidoc/ol.source.OSM.html" title="API documentation for ol.source.OSM">ol.source.OSM</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.source.Vector.html" title="API documentation for ol.source.Vector">ol.source.Vector</a> -->
        <a href="v3.19.1/apidoc/ol.source.Vector.html" title="API documentation for ol.source.Vector">ol.source.Vector</a>
       </li>
       </ui>
      </div>
     </div>
    </div>
    <div class="row-fluid">
     <div id="source-controls">
      <a id="copy-button">
       <i class="fa fa-clipboard"></i> Copy
      </a>
      <a id="jsfiddle-button">
       <i class="fa fa-jsfiddle"></i> Edit
      </a>
     </div>
     <form method="POST" id="jsfiddle-form" target="_blank" action="http://jsfiddle.net/api/post/jquery/1.11.0/">
     <textarea class="hidden" name="js">
// --- 省略 ---
&lt;/html&gt;</code></pre>
   </div>
  </div>
  <!--
  <script src="./resources/common.js"></script>
  <script src="./resources/prism/prism.min.js"></script>
  -->
  <!-- ディレクトリ修正
   CommonJS と
   prism.js
 -->
  <script src="v3.19.1/examples/resources/common.js"></script>
  <script src="v3.19.1/examples/resources/prism/prism.min.js"></script>
  <!-- 
  <script src="loader.js?id=draw-shapes"></script>
  -->
  <!-- ファイル修正 -->  <!-- ディレクトリ修正 -->
  <script src="loader.js?id=2161-ol3ex"></script>
 </body>
 <script>
  var packageUrl = 'https://raw.githubusercontent.com/openlayers/openlayers.github.io/build/package.json';
  fetch(packageUrl).then(function(response) {
  /** GlobalFetch.fetch()(This is an experimental technology)
   * The fetch() method of the GlobalFetch interface 
   * starts the process of fetching a resource. This 
   * returns a promise that resolves to the Response 
   * object representing the response to your request.
   * GlobalFetch インタフェースの fetch() メソッドは、リソー
   * スを取得する処理を開始します。これは要求に対する応答を表す 
   * Response オブジェクトに解決のプロミス(promise)を返しま
   * す。
   *(MDN[https://developer.mozilla.org/ja/docs/Web/API/
   * FGlobalFetch/fetch])
   */
   return response.json();
   /** Response(This is an experimental technology)
    * The Response interface of the Fetch API represents 
    * the response to a request.
    * Fetch API の Response インタフェースは、要求に対する応答
    * を表します。
    * (MDN[https://developer.mozilla.org/en-US/docs/Web/
    * API/Response])
    */
   /** Body.json()(This is an experimental technology)
    * The json() method of the Body mixin takes a Response 
    * stream and reads it to completion. It returns a 
    * promise that resolves with an object literal 
    * containing the JSON data.
    * Body mixin の json() メソッドは、Response ストリームを
    * 受け取り、それを完了させるために読み込みます。これは、
    * JSON データを含むオブジェクトリテラルで解決する約束
    * (promisee)を返します。
    * (MDN[https://developer.mozilla.org/en-US/docs/Web/
    * API/Body/json])
    */
  }).then(function(json) {
   var latestVersion = json.version;
   document.getElementById('latest-version').innerHTML = latestVersion;
   var url = window.location.href;
   var branchSearch = url.match(/\/([^\/]*)\/examples\//);
   /** String.prototype.match()
    * 正規表現 に対する 文字列 のマッチングの際に、そのマッチ結
    * 果を得るために使われます。
    * (MDN[https://developer.mozilla.org/ja/docs/Web/
    * JavaScript/Reference/Global_Objects/String/match])
    */
   var cookieText = 'dismissed=-' + latestVersion + '-';
   var dismissed = document.cookie.indexOf(cookieText) != -1;
   /** String.prototype.indexOf()
    * 呼び出す String オブジェクト 中で、指定された値が最初に現
    * れたインデックスを返します。fromIndex から検索を始め、値が
    * 見つからない場合は -1 を返します。
    * (MDN[https://developer.mozilla.org/ja/docs/Web/
    * JavaScript/Reference/Global_Objects/String/indexOf])
    */
   if (!dismissed && /^v[0-9\.]*$/.test(branchSearch[1]) && '3.16.0' != latestVersion) {
    var link = url.replace(branchSearch[0], '/latest/examples/');
    /** Location.replace()
     * The Location.replace() method replaces the current 
     * resource with the one at the provided URL. The 
     * difference from the assign() method is that after 
     * using replace() the current page will not be saved 
     * in session History, meaning the user won't be able 
     * to use the back button to navigate to it.
     * 指定された URL に現在の文書を置き換えます。 assign() メ
     * ソッドとの違いは、replace() を用いた後、現在のページは、
     * セッションの履歴には保持されないことです。つまり、ユーザ
     * は、置き換え前のページに戻るために、戻るボタンを使うこと
     * ができません。
     * (MDN[https://developer.mozilla.org/en-US/docs/Web/
     * API/Location/replace])
     */
    fetch(link, {method: 'head'}).then(function(response) {
     var a = document.getElementById('latest-link');
     a.href = response.status == 200 ? link : '../../latest/examples/';
     /** Response.status(This is an experimental technology)
      * The status read-only property of the Response 
      * interface contains the status code of the response 
      * (e.g., 200 for a success).
      * Response インタフェースの status 読み取り専用プロパティ
      * は、応答のステータス・コード(例えば、成功のために 200)
      * を含みます。
     * (MDN[https://developer.mozilla.org/en-US/docs/Web/
     * API/Response/status])
      */
    });
    var latestCheck = document.getElementById('latest-check');
    latestCheck.style.display = '';
    document.getElementById('latest-dismiss').onclick = function() {
     latestCheck.style.display = 'none';
     document.cookie = cookieText;
    }
   }
  });
 </script>
</html>


COMMONJS は

COMMONJS
http://webpack.github.io/docs/commonjs.html

に、次のようにあります。

The CommonJS group defined a module format to solve JavaScript scope issues by making sure each module is executed in its own namespace.
This is achieved by forcing modules to explicitly export those variables it wants to expose to the “universe”, and also by defining those other modules required to properly work.
To achieve this CommonJS give you two tools:
the require() function, which allows to import a given module into the current scope.
the module object, which allows to export something from the current scope.

CommonJSグループは、それ自身の名前空間内で実行されている各モジュールを確認することによって、JavaScriptのスコープ問題を解決するためのモジュールフォーマットを定義しました。
これは、それが「universe(?)」に公開したい変数を明示的にエクスポートするモジュールを強制することによって、同じように、正常に動作するのに必要な他のモジュールを定義することによって、達成されます。
この CommonJS を達成するために2つのツールを与えます:
require()関数、指定したモジュールを現在のスコープにインポートすることができます。
モジュールオブジェクト、現在のスコープからエクスポートすることができます。


Prism は、

Prism
http://prismjs.com/

に、次のようにあります。

Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind. It’s a spin-off from Dabblet and is tested there daily by thousands.
Prismは、最新のWeb標準に構築されたことを考慮し軽量で拡張可能なシンタックスハイライトです。それは Dabblet からスピンオフで、何千人も日々そこで試験されています。


ZeroClipboard は

ZeroClipboard v2.x
http://zeroclipboard.org/

に、次のようにあります。

The ZeroClipboard library provides an easy way to copy text to the clipboard using an invisible Adobe Flash movie and a JavaScript interface.
ZeroClipboard ライブラリは、見えない Adobe Flash ムービーとJavaScript のインターフェイスを使用してテキストをクリップボードにコピーする簡単な方法を提供します。

Debian 8 では動作しませんでした。ボタンを右クリックしたときに flash のコンテキストメニューが表示されると動作しています。