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

2018年9月26日水曜日

OpenLayers5 Workshop - 2.5 Snapping

2 Vector Data
2.5 Snapping
スナップ

You may have noticed that it is easy to draw features that don't line up nicely with existing features. In addition, when modifying features, we can break topology — adding a void between polygons that were previously adjacent. The Snap interaction can be used to help preserve topology while drawing and editing features.

既存のフィーチャと一緒にきちんと並ばないフィーチャを描画することは簡単であることに注意します。加えて、フィーチャを変形するとき、トポロジを壊すことができ - 元は隣りにあったポリゴンの間の空所を追加します。Snap インタラクションは、フィーチャを描画および編集する間、トポロジを維持するのに役立てるために使われます。

First, import the Snap interaction into your main.js:

最初に、Snap インタラクションを main.js にインポートします:

import Snap from 'ol/interaction/Snap';

As with the other editing interactions, we'll configure the snap interaction to work with our vector source and add it to the map:

他の編集インタラクションと同様に、ベクタソースで動作し、マップに追加するために snap インタラクションを設定します:

map.addInteraction(new Snap({
 source: source
}));

With the draw, modify, and snap interactions all active, we can edit data while maintaining topology.

draw と modify、snap インタラクションがすべて有効で、トポロジを維持してる間、データを編集できます。

Uniting nations with the snap interaction

■□ Debian9 で試します■□
前回使用した main.js のバックアップを保存して次のように修正します。

user@deb9-vmw:~/openlayers-workshop-en$ cp main.js main.js_draw user@deb9-vmw:~/openlayers-workshop-en$ vim main.js
import 'ol/ol.css';
import GeoJSON from 'ol/format/GeoJSON':
import Map from 'ol/Map';
import VectorLayer from 'ol/layer/Vector';
import VectorSource from 'ol/source/Vector';
import View from 'ol/View';
import DragAndDrop from 'ol/interaction/DragAndDrop';
import Modify from 'ol/interaction/Modify';
import Draw from 'ol/interaction/Draw';
import Snap from 'ol/interaction/Snap';
import sync from 'ol-hashed';
const map = new Map({
 target: 'map-container',
 view: new View({
  center: [0, 0],
  zoom: 2
 })
}); 
sync(map);

const source = new VectorSource();

const layer = new VectorLayer({
 source: source
});
map.addLayer(layer);

map.addInteraction(new DragAndDrop({
 source: source,
 formatConstructors: [GeoJSON]
}));

map.addInteraction(new Modify({
 source: source
}));

map.addInteraction(new Draw({
 type: 'Polygon',
 source: source
}));

map.addInteraction(new Snap({
 source: source
}));
http://localhost:3000/ とブラウザでマップを開きます。(もし開かなければ、'npm start' を実行してください。

1辺が接している三角形を作成します。2個めの三角形を作成するとき、頂点にポインタを合わせるのが簡単にできます。

三角形を描画していきます。
頂点を合わせてダブルクリックします。

Snap インタラクションを設定していないと、接する辺を変形させたときに一方の三角形の辺(境界線)しか変形しません。(両方の境界線をつかむのが難しくなります。)


■□ここまで■□

2015年5月23日土曜日

2 - ol3.5ex 118b - Snap interaction example 2

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

「2118-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.MapQuest({layer: 'sat'})
 /** ol.source.MapQuest
  * Layer source for the MapQuest tile server.
  * MapQuest タイルサーバのレイヤソース。(ol3 API
  * 2 - ol3ex 23b - MapQuest example 2 参照)
  */
});
var vector = new ol.layer.Vector({
/** ol.layer.Vector
 * Vector data that is rendered client-side.
 * クライアント側で描画されたベクタデータ。(ol3 API)
 */
 source: new ol.source.Vector(),
 /** ol.source.Vector
  * Provides a source of features for vector layers.
  * ベクタレイヤのフィーチャのソースを用意します。(ol3 API)
  */
 style: new ol.style.Style({
 /** ol.style.Style 
  * Base class for vector feature rendering styles.
  * ベクタフィーチャがスタイルを描画するための基本クラス。
  * (ol3 API)
  */
  fill: new ol.style.Fill({
  /** ol.style.Fill 
   * Set fill style for vector features.
   * ベクタフィーチャの塗りつぶしスタイルを設定。(ol3 API)
   */
   color: 'rgba(255, 255, 255, 0.2)'
  }),
  stroke: new ol.style.Stroke({
  /** ol.style.Stroke 
   * Set stroke style for vector features. 
   * Note that the defaults given are the Canvas defaults, 
   * which will be used if option is not defined. 
   * The get functions return whatever was entered 
   * in the options;  they will not return the default.
   * ベクタフィーチャのためのストロークスタイルの設定。
   * デフォルトは、オプションが定義されていない場合に使用され
   * る Canvas のデフォルトを与えられることに注意してください。
   * GET関数は、オプションで入力されたものはすべて返します。
   * それらはデフォルトを返しません。(ol3 API)
   */
   color: '#ffcc33',
   width: 2
  }),
  image: new ol.style.Circle({
  /** ol.style.Circle
   * Set circle style for vector features.
   * ベクタフィーチャの円のスタイルを設定。(ol3 API)
   */
   radius: 7,
   fill: new ol.style.Fill({
    color: '#ffcc33'
   })
  })
 })
});
var map = new ol.Map({
 layers: [raster, vector],
 target: 'map',
 view: new ol.View({
  center: [-11000000, 4600000],
  zoom: 4
 })
});
var Modify = {
 init: function() {
  this.select = new ol.interaction.Select();
  /** ol.interaction.Select 
   * Handles selection of vector data. A 
   * ol.FeatureOverlay is maintained internally to store 
   * the selected feature(s). Which features are selected 
   * is determined by the condition option, and optionally 
   * the toggle or add/remove options.
   * ベクタデータの選択を処理します。 ol.FeatureOverlay 
   * は、選択したフィーチャを格納するために内部的に維持され
   * ています。選択されているどのフィーチャでも条件オプショ
   * ン、そして部分的にトグルまたは追加/削除オプションによっ
   * て決定されます。(ol3 API)
   */
  map.addInteraction(this.select);
  /** addInteraction(interaction)
   * Add the given interaction to the map.
   * マップへ与えられたインターラクションを追加します。
   * (ol3 API)
   */
  this.modify = new ol.interaction.Modify({
  /** ol.interaction.Modify 
   * Interaction for modifying vector data.
   * ベクタデータを変形するためのインタラクション。
   * (ol3 API)
   */
   features: this.select.getFeatures()
   /** getFeatures()
    * Get the selected features.
    * 選択されたフィーチャを取得します。
    * Return: Features collection(ol3 API)
    */
  });
  map.addInteraction(this.modify);
  this.setEvents();
 },
 setEvents: function() {
  var selectedFeatures = this.select.getFeatures();
  this.select.on('change:active', function() {
  /** on
   * Listen for a certain type of event.
   * あるタイプのイベントをリッスンします。(ol3 API)
   */
   selectedFeatures.forEach(selectedFeatures.remove, selectedFeatures);
   /** forEach(f, opt_this)
    * Iterate over each element, calling the provided 
    * callback.
    * 提供されたコールバックを呼び出すため、各要素を反復処理しま
    * す。(ol3 API)
    */
   /** remove(elem)
    * Remove the first occurrence of an element from 
    * the collection.
    * コレクションから最初に発生する要素を削除します。(ol3 API)
    */
  });
 },
 setActive: function(active) {
  this.select.setActive(active);
  /** setActive(active)
   * Activate or deactivate the interaction.
   * インターラクションを有効または無効にします。
   * (ol3 API[説明は Stable Only のチェックを外すと表示])
   */
  this.modify.setActive(active);
  }
};
Modify.init();
var Draw = {
 init: function() {
  map.addInteraction(this.Point);
  this.Point.setActive(false);
  map.addInteraction(this.LineString);
  this.LineString.setActive(false);
  map.addInteraction(this.Polygon);
  this.Polygon.setActive(false);
 },
 Point: new ol.interaction.Draw({
 /** ol.interaction.Draw 
  * Interaction that allows drawing geometries.
  * ジオメトリの描画を認めるインターラクション。(ol3 API)
  */
  source: vector.getSource(),
  /** getSource()
   * Return: Source.(ol3 API)
   */
   type: /** @type {ol.geom.GeometryType} */ ('Point')
   /** @type 
    * 値のタイプ(型)の説明 - 式などで表示
    * (@use JSDoc[http://usejsdoc.org/]より)
    */
 }),
 LineString: new ol.interaction.Draw({
  source: vector.getSource(),
  type: /** @type {ol.geom.GeometryType} */ ('LineString')
 }),
 Polygon: new ol.interaction.Draw({
  source: vector.getSource(),
  type: /** @type {ol.geom.GeometryType} */ ('Polygon')
 }),
 getActive: function() {
  return this.activeType ? this[this.activeType].getActive() : false;
  /** 条件演算子 condition ? expr1 : expr2 
   * condition: true か false かを評価する条件文です。
   * expr1, expr2: 各々の値の場合に実行する式です。
   * condition が true の場合、演算子は expr1 の値を選択します。
   * そうでない場合は expr2 の値を選択します。
   * (MDN[https://developer.mozilla.org/ja/docs/Web/
   * JavaScript/Guide/Expressions_and_Operators])
   */
  /** getActive()
   * Return whether the interaction is currently active.
   * インターラクションが現在有効かどうかを返します。
   * true if the interaction is active, false otherwise.
   * (ol3 API[説明は Stable Only のチェックを外すと表示])
   */
 },
 setActive: function(active) {
  var type = optionsForm.elements['draw-type'].value;
  if (active) {
   this.activeType && this[this.activeType].setActive(false);
   this[type].setActive(true);
   this.activeType = type;
  } else {
   this.activeType && this[this.activeType].setActive(false);
   this.activeType = null;
  }
 }
};
Draw.init();
var optionsForm = document.getElementById('options-form');
/**
 * Let user change the geometry type.
 * @param {Event} e Change event.
 */
/** 「@param」
 * The @param tag provides the name, type, and description 
 * of a function parameter.
 * The @param tag requires you to specify the name of the 
 * parameter you are documenting. You can also include the 
 * parameter's type, enclosed in curly brackets, and a 
 * description of the parameter.
 * @paramタグは、関数パラメータの名前と型、説明を提供します。
 * @paramタグを使用すると、文書化されたパラメータの名前を
 * 指定する必要があります。また、パラメータのタイプと、中括弧
 * で囲まれたおよびパラメータの説明を含めることができます。
 * (@use JSDoc [http://usejsdoc.org/tags-param.html])
 */
optionsForm.onchange = function(e) {
/** 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])
 */
 var type = e.target.getAttribute('name');
 /** element.getAttribute
  * getAttribute() は指定の要素について名前付けされた属性の
  * 値を返します。名前付けされた属性が存在しなければ、返され
  * る値は null もしくは ""(空文字列)となります。
  * (MDN[https://developer.mozilla.org/ja/docs/Web/
  * API/Element/getAttribute])
  */
 var value = e.target.value;
 if (type == 'draw-type') {
  Draw.getActive() && Draw.setActive(true);
 } else if (type == 'interaction') {
  if (value == 'modify') {
   Draw.setActive(false);
   Modify.setActive(true);
  } else if (value == 'draw') {
   Draw.setActive(true);
   Modify.setActive(false);
  }
 }
};
Draw.setActive(true);
Modify.setActive(false);
/** The snap interaction must be added after the Modify 
 * and Draw interactions in order for its map browser 
 * event handlers to be fired first. Its handlers are 
 * responsible of doing the snapping.
 * スナップインタラクションは、そのマップブラウザのイベント
 * ハンドラが最初に発生するために、Modify と Draw インタラ
 * クションの後で追加される必要があります。そのハンドラは、
 * スナップを実行しなければなりません。
 */
var snap = new ol.interaction.Snap({
/** ol.interaction.Snap
 * Handles snapping of vector features while modifying 
 * or drawing them. The features can come from a 
 * ol.source.Vector or ol.Collection Any interaction 
 * object that allows the user to interact with the 
 * features using the mouse can benefit from the 
 * snapping, as long as it is added before.
 * The snap interaction modifies map browser event 
 * coordinate and pixel properties to force the snap to 
 * occur to any interaction that them.
 * 変更または描画の間、ベクタフィーチャのスナップを処理しま
 * す。フィーチャは、ol.source.Vector または ol.Collection 
 * 由来です。ユーザーがマウスを使用してフィーチャをインタラ
 * クションすることを可能にする任意のインタラクションオブジェ
 * クトは、それが前に追加されるように、スナップの恩恵を得る
 * ことができます。スナップインタラクションは、マップブラウ
 * ザイベントコーディネートと画素特性をそれらの任意のインタ
 * ラクションのために発生するスナップへ強制的に変更します。 
 * (ol3 API)
 */
 source: vector.getSource()
});
map.addInteraction(snap);
 

2 - ol3.5ex 118a - Snap interaction example 1

「Snap interaction example (snap.html)」を参考に地図を表示してみます。
説明に次のようにあります。

Example of using the snap interaction together with draw and modify interactions. The snap interaction must be added last, as it needs to be the first to handle the pointermove event.
インタラクションを描画と変形が一緒のスナップインタラクションを使用する例。スナップインタラクションは、最後に追加する必要がありますが、それは pointermove イベントを処理を最初にする必要があります。

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





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





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



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








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











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

「2118-ol3ex.html」
<!doctype html>
<html lang="en">
 <head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="chrome=1">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.1/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>
  「resources」の位置が変わりました。
  -->
  <!-- ディレクトリ修正 -->
  <link rel="stylesheet" href="v3.5.0/css/ol.css" type="text/css">
  <link rel="stylesheet" href="v3.5.0/examples/resources/layout.css" type="text/css">

  <link rel="stylesheet" href="v3.5.0/examples/resources/prism/prism.css" type="text/css">
  <script src="v3.5.0/examples/resources/zeroclipboard/ZeroClipboard.min.js"></script>
  <title>Snap interaction example</title>
 </head>
 <body>
  <!-- 
  bootstrap-combined.min.css, ol.css, layout.css, prism.css
  CSSファイルで設定されたセレクタを使用。
  -->
  <div class="navbar navbar-inverse navbar-fixed-top">
   <div class="navbar-inner">
    <div class="container">
     <!--
     <a class="brand" href="./"><img src="./resources/logo-70x70.png"> OpenLayers 3 Examples</a>
     -->
     <!-- ディレクトリ修正 -->
     <a class="brand" href="v3.5.0/examples/"><img src="v3.5.0/examples/resources/logo-70x70.png"> OpenLayers 3 Examples</a>
    </div>
   </div>
  </div>
  <div class="container-fluid">
   <div class="row-fluid">
    <div class="span12">
     <div id="map" class="map"></div>
    </div>
   </div>
   <div class="row-fluid">
    <div class="span12">
     <h4 id="title">Snap interaction example</h4>
     <p id="shortdesc">Example of using the snap interaction 
      together with draw and modify interactions.</p>
     <div id="docs">
      <p>Example of using the snap interaction 
       together with draw and modify interactions. The snap 
       interaction must be added last, as it needs to be the 
       first to handle the <code>pointermove</code> event.
       </p>
       <form id="options-form" automplete="off">
        <div class="radio">
         <label>
          <input type="radio" name="interaction" value="draw" id="draw" checked>
          Draw &nbsp;
         </label>
        </div>
        <div class="radio">
         <label>
          <input type="radio" name="interaction" value="modify">
          Modify &nbsp;
         </label>
        </div>
        <div class="form-group">
         <label>Draw type &nbsp;</label>
         <select name="draw-type" id="draw-type">
          <option value="Point">Point</option>
          <option value="LineString">LineString</option>
          <option value="Polygon">Polygon</option>
         </select>
        </div>
       </form>
     </div>
     <div id="tags">draw, edit, modify, vector, 
     featureoverlay, snap</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.5.0/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.5.0/apidoc/ol.View.html" title="API documentation for ol.View">ol.View</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.interaction.html" title="API documentation for ol.interaction">ol.interaction>/a> -->
        <a href="v3.5.0/apidoc/ol.interaction.html" title="API documentation for ol.interaction">ol.interaction</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.interaction.Draw.html" title="API documentation for ol.interaction.Draw">ol.interaction.Draw>/a> -->
        <a href="v3.5.0/apidoc/ol.interaction.Draw.html" title="API documentation for ol.interaction.Draw">ol.interaction.Draw</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.interaction.Modify.html" title="API documentation for ol.interaction.Modify">ol.interaction.Modify>/a> -->
        <a href="v3.5.0/apidoc/ol.interaction.Modify.html" title="API documentation for ol.interaction.Modify">ol.interaction.Modify</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.interaction.Select.html" title="API documentation for ol.interaction.Select">ol.interaction.Select>/a> -->
        <a href="v3.5.0/apidoc/ol.interaction.Select.html" title="API documentation for ol.interaction.Select">ol.interaction.Select</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.interaction.Snap.html" title="API documentation for ol.interaction.Snap">ol.interaction.Snap>/a> -->
        <a href="v3.5.0/apidoc/ol.interaction.html" title="API documentation for ol.interaction">ol.interaction</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.layer.Tile.html" title="API documentation for ol.layer.Tile">ol.layer.Tile>/a> -->
        <a href="v3.5.0/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.5.0/apidoc/ol.layer.Vector.html" title="API documentation for ol.layer.Vector">ol.layer.Vector</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.source.MapQuest.html" title="API documentation for ol.source.MapQuest">ol.source.MapQuest</a> -->
        <a href="v3.5.0/apidoc/ol.source.MapQuest.html" title="API documentation for ol.source.MapQuest">ol.source.MapQuest</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.source.Vector.html" title="API documentation for ol.source.Vector">ol.source.Vector</a> -->
        <a href="v3.5.0/apidoc/ol.source.Vector.html" title="API documentation for ol.source.Vector">ol.source.Vector</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.style.Circle.html" title="API documentation for ol.style.Circle">ol.style.Circle</a> -->
        <a href="v3.5.0/apidoc/ol.style.Circle.html" title="API documentation for ol.style.Circle">ol.style.Circle</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.style.Fill.html" title="API documentation for ol.style.Fill">ol.style.Fill</a> -->
        <a href="v3.5.0/apidoc/ol.style.Fill.html" title="API documentation for ol.style.Fill">ol.style.Fill</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.style.Stroke.html" title="API documentation for ol.style.Stroke">ol.style.Stroke</a> -->
        <a href="v3.5.0/apidoc/ol.style.Stroke.html" title="API documentation for ol.style.Stroke">ol.style.Stroke</a>
       </li>,
       <li>
        <!-- <a href="../apidoc/ol.style.Style.html" title="API documentation for ol.style.Style">ol.style.Style</a> -->
        <a href="v3.5.0/apidoc/ol.style.Style.html" title="API documentation for ol.style.Style">ol.style.Style</a>
       </li>,
      </ui>,
     </div>
   </div>
  </div>
  <div class="row-fluid">
   <hr>
   <form method="POST" target="_blank" action="http://jsfiddle.net/api/post/jquery/1.11.0/">
    <input type="button" class="btn btn-info" id="copy-button" value="Copy example code">
    <input type="submit" class="btn btn-primary" id="jsfiddle-button" value="Create JSFiddle">
    <textarea class="hidden" name="js">
// --- 省略 ---
&lt;/html&gt;</code></pre>
    </div>
   </div>
  </div>
  <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>
  <!--
  <script src="./resources/common.js"></script>
  <script src="./resources/prism/prism.min.js"></script>
  -->
  <!-- ディレクトリ修正
   CommonJS と
   prism.js
 -->
  <script src="v3.5.0/examples/resources/common.js"></script>
  <script src="v3.5.0/examples/resources/prism/prism.min.js"></script>
  <!-- 
  <script src="loader.js?id=snap"></script>
  -->
  <!-- ファイル修正 -->  <!-- ディレクトリ修正 -->
  <script src="loader.js?id=2118-ol3ex"></script>
  </body>
</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 のコンテキストメニューが表示されると動作しています。