<commit_before>
//
// Copyright 2016 Kary Foundation, Inc.
//   Author: Pouya Kary <k@karyfoundation.org>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//

//
// ─── MENU ───────────────────────────────────────────────────────────────────────
//

    var MainMenu = [

        //
        // ─── FILE ────────────────────────────────────────────────────────
        //

            {
                label: 'File',
                submenu: [
                    {
                        label: 'New File',
                        accelerator: 'CmdOrCtrl+N',
                        click: onNewFile
                    },
                    {
                        label: 'New Window',
                        accelerator: 'Shift+CmdOrCtrl+N',
                        click: openNewWindow
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Open...',
                        accelerator: 'CmdOrCtrl+O',
                        click: onOpenFile
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Save',
                        accelerator: 'CmdOrCtrl+S',
                        click: ( ) => onSaveFile( )
                    },
                    {
                        label: 'Save As',
                        accelerator: 'Shift+CmdOrCtrl+S',
                        click: onSaveFileAs
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Export to SVG',
                        accelerator: 'CmdOrCtrl+E',
                        click: onExportWorkspaceToSVG
                    },
                ]
            },

        //
        // ─── EDIT MENU ───────────────────────────────────────────────────
        //

            {
                label: 'Edit',
                submenu: [
                    {
                        label: 'Undo',
                        accelerator: 'CmdOrCtrl+Z',
                        role: 'undo'
                    },
                    /*
                    {
                        label: 'Redo',
                        accelerator: 'Shift+CmdOrCtrl+Z',
                        role: 'redo'
                    },*/
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Cut',
                        accelerator: 'CmdOrCtrl+X',
                        role: 'cut'
                    },
                    {
                        label: 'Copy',
                        accelerator: 'CmdOrCtrl+C',
                        role: 'copy'
                    },
                    {
                        label: 'Copy Compiled RegExp',
                        accelerator: 'Shift+CmdOrCtrl+C',
                        click: onCopyRegExp
                    },
                    {
                        label: 'Paste',
                        accelerator: 'CmdOrCtrl+V',
                        role: 'paste'
                    },
                    {
                        label: 'Select All',
                        accelerator: 'CmdOrCtrl+A',
                        role: 'selectall'
                    }
                ]
            },

        //
        // ─── VIEW MENU ───────────────────────────────────────────────────
        //

            {
                label: 'View',
                submenu: [
                    {
                        label: 'Night Mode',
                        accelerator: 'Shift+CmdOrCtrl+N',
                        click: changeColorMode,
                        type: 'checkbox'
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Editor',
                        accelerator: 'CmdOrCtrl+E',
                        click: onChangeWindowToEditor,
                        type: 'radio'
                    },
                    {
                        label: 'Playground',
                        accelerator: 'CmdOrCtrl+P',
                        click: onChangeWindowToPlayground,
                        type: 'radio'
                    }
                ]
            },

        //
        // ─── WINDOW MENU ────────────────────────────────────────────────────────────────
        //

            {
                label: 'Window',
                role: 'window',
                submenu: [
                    {
                        role: 'minimize'
                    },
                    {
                        role: 'togglefullscreen'
                    },
                    {
                        role: 'close'
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: "Open Developer Tools",
                        click: OrchestraWindow.openDevTools
                    }
                ]
            },

        //
        // ─── HELP MENU ──────────────────────────────────────────────────────────────────
        //

            {
                label: 'Help',
                role: 'help',
                submenu: [
                    {
                        label: "Quartet Language's Reference (Offline)",
                        click: onOpenHelpPage
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: "RegExp on ECMA-262 Edition 6.0 (June 2015)",
                        click: ( ) => openExternal('http://www.ecma-international.org/ecma-262/6.0/#sec-regexp-regular-expression-objects')
                    },
                    {
                        label: "RegExp on Mozilla Developer Network",
                        click: ( ) => openExternal('https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/RegExp')
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: "Kary Foundation's Website",
                        click: ( ) => openExternal('https://www.karyfoundation.org/')
                    },
                    {
                        label: "Report an issue...",
                        click: ( ) => openExternal('https://github.com/karyfoundation/orchestra/issues')
                    },
                    {
                        label: "Orchestra and Quartet on GitHub",
                        click: ( ) => openExternal('https://github.com/karyfoundation/orchestra')
                    },
                ]
            },

        // ────────────────────────────────────────────────────────────────────────────────

    ];

//
// ─── OS SPECIFIC MENUS ──────────────────────────────────────────────────────────
//

    var AboutPageButton = {
        label: 'About Orchestra',
        click: openAboutPage
    }

    if ( process.platform == 'darwin' ) {
        var name = require( 'electron' ).remote.app.getName( )
        var menuIndex = MainMenu.length - 1
        MainMenu.unshift(
            {
                label: name,
                submenu: [
                    AboutPageButton,
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Services',
                        role: 'services',
                        submenu: [ ]
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Hide ' + name,
                        accelerator: 'Command+H',
                        role: 'hide'
                    },
                    {
                        label: 'Hide Others',
                        accelerator: 'Command+Alt+H',
                        role: 'hideothers'
                    },
                    {
                        label: 'Show All',
                        role: 'unhide'
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Quit',
                        accelerator: 'Command+Q',
                        click: fireAppQuitRequest
                    },
                ]
            }
        )
    } else {
        MainMenu[ menuIndex ].submenu.push( AboutPageButton )
    }

//
// ─── INIT MENU ──────────────────────────────────────────────────────────────────
//

    function initMainMenu ( ) {
        const remote = require('electron').remote
        const Menu = remote.Menu
        const MenuItem = remote.MenuItem

        OrchestraAppMenu = Menu.buildFromTemplate( MainMenu )
        Menu.setApplicationMenu( OrchestraAppMenu )
    }

//
// ─── ON MENU DISABLE ────────────────────────────────────────────────────────────
//

    function setMenuEnableFactor ( control ) {
        for ( let menuIndex = 0; menuIndex < OrchestraAppMenu.items.length; menuIndex++ ) {
            let submenu = OrchestraAppMenu.items[ menuIndex ].submenu.items
            for ( let submenuIndex = 0; submenuIndex < submenu.length; submenuIndex++ )
                submenu[ submenuIndex ].enabled = control;
        }
    }

//
// ─── GET VIEW MENU ITEMS ────────────────────────────────────────────────────────
//

    function getViewMenuItems ( ) {
        return OrchestraAppMenu.items[ OrchestraAppMenu.items.length - 3 ]
    }

//
// ─── SET COLOR MODE ACTIVATION ──────────────────────────────────────────────────
//

    function setViewColorModeMenuActivation ( state ) {
        getViewMenuItems( ).submenu.items[ 0 ].checked = state
    }

//
// ─── SET ACTIVE TAB ─────────────────────────────────────────────────────────────
//

    function setActiveTabInMenu ( ) {
        let index = ( CurrentActiveView === 'editor' )? 2 : 3
        getViewMenuItems( ).submenu.items[ index ].checked = true
    }

// ────────────────────────────────────────────────────────────────────────────────
<commit_msg>accelerator for dev tools<commit_after>
//
// Copyright 2016 Kary Foundation, Inc.
//   Author: Pouya Kary <k@karyfoundation.org>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//

//
// ─── MENU ───────────────────────────────────────────────────────────────────────
//

    var MainMenu = [

        //
        // ─── FILE ────────────────────────────────────────────────────────
        //

            {
                label: 'File',
                submenu: [
                    {
                        label: 'New File',
                        accelerator: 'CmdOrCtrl+N',
                        click: onNewFile
                    },
                    {
                        label: 'New Window',
                        accelerator: 'Shift+CmdOrCtrl+N',
                        click: openNewWindow
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Open...',
                        accelerator: 'CmdOrCtrl+O',
                        click: onOpenFile
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Save',
                        accelerator: 'CmdOrCtrl+S',
                        click: ( ) => onSaveFile( )
                    },
                    {
                        label: 'Save As',
                        accelerator: 'Shift+CmdOrCtrl+S',
                        click: onSaveFileAs
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Export to SVG',
                        accelerator: 'CmdOrCtrl+E',
                        click: onExportWorkspaceToSVG
                    },
                ]
            },

        //
        // ─── EDIT MENU ───────────────────────────────────────────────────
        //

            {
                label: 'Edit',
                submenu: [
                    {
                        label: 'Undo',
                        accelerator: 'CmdOrCtrl+Z',
                        role: 'undo'
                    },
                    /*
                    {
                        label: 'Redo',
                        accelerator: 'Shift+CmdOrCtrl+Z',
                        role: 'redo'
                    },*/
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Cut',
                        accelerator: 'CmdOrCtrl+X',
                        role: 'cut'
                    },
                    {
                        label: 'Copy',
                        accelerator: 'CmdOrCtrl+C',
                        role: 'copy'
                    },
                    {
                        label: 'Copy Compiled RegExp',
                        accelerator: 'Shift+CmdOrCtrl+C',
                        click: onCopyRegExp
                    },
                    {
                        label: 'Paste',
                        accelerator: 'CmdOrCtrl+V',
                        role: 'paste'
                    },
                    {
                        label: 'Select All',
                        accelerator: 'CmdOrCtrl+A',
                        role: 'selectall'
                    }
                ]
            },

        //
        // ─── VIEW MENU ───────────────────────────────────────────────────
        //

            {
                label: 'View',
                submenu: [
                    {
                        label: 'Night Mode',
                        accelerator: 'Shift+CmdOrCtrl+N',
                        click: changeColorMode,
                        type: 'checkbox'
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Editor',
                        accelerator: 'CmdOrCtrl+E',
                        click: onChangeWindowToEditor,
                        type: 'radio'
                    },
                    {
                        label: 'Playground',
                        accelerator: 'CmdOrCtrl+P',
                        click: onChangeWindowToPlayground,
                        type: 'radio'
                    }
                ]
            },

        //
        // ─── WINDOW MENU ────────────────────────────────────────────────────────────────
        //

            {
                label: 'Window',
                role: 'window',
                submenu: [
                    {
                        role: 'minimize'
                    },
                    {
                        role: 'togglefullscreen'
                    },
                    {
                        role: 'close'
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: "Open Developer Tools",
                        accelerator: "Shift+CmdOrCtrl+D",
                        click: OrchestraWindow.openDevTools
                    }
                ]
            },

        //
        // ─── HELP MENU ──────────────────────────────────────────────────────────────────
        //

            {
                label: 'Help',
                role: 'help',
                submenu: [
                    {
                        label: "Quartet Language's Reference (Offline)",
                        click: onOpenHelpPage
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: "RegExp on ECMA-262 Edition 6.0 (June 2015)",
                        click: ( ) => openExternal('http://www.ecma-international.org/ecma-262/6.0/#sec-regexp-regular-expression-objects')
                    },
                    {
                        label: "RegExp on Mozilla Developer Network",
                        click: ( ) => openExternal('https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/RegExp')
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: "Kary Foundation's Website",
                        click: ( ) => openExternal('https://www.karyfoundation.org/')
                    },
                    {
                        label: "Report an issue...",
                        click: ( ) => openExternal('https://github.com/karyfoundation/orchestra/issues')
                    },
                    {
                        label: "Orchestra and Quartet on GitHub",
                        click: ( ) => openExternal('https://github.com/karyfoundation/orchestra')
                    },
                ]
            },

        // ────────────────────────────────────────────────────────────────────────────────

    ];

//
// ─── OS SPECIFIC MENUS ──────────────────────────────────────────────────────────
//

    var AboutPageButton = {
        label: 'About Orchestra',
        click: openAboutPage
    }

    if ( process.platform == 'darwin' ) {
        var name = require( 'electron' ).remote.app.getName( )
        var menuIndex = MainMenu.length - 1
        MainMenu.unshift(
            {
                label: name,
                submenu: [
                    AboutPageButton,
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Services',
                        role: 'services',
                        submenu: [ ]
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Hide ' + name,
                        accelerator: 'Command+H',
                        role: 'hide'
                    },
                    {
                        label: 'Hide Others',
                        accelerator: 'Command+Alt+H',
                        role: 'hideothers'
                    },
                    {
                        label: 'Show All',
                        role: 'unhide'
                    },
                    {
                        type: 'separator'
                    },
                    {
                        label: 'Quit',
                        accelerator: 'Command+Q',
                        click: fireAppQuitRequest
                    },
                ]
            }
        )
    } else {
        MainMenu[ menuIndex ].submenu.push( AboutPageButton )
    }

//
// ─── INIT MENU ──────────────────────────────────────────────────────────────────
//

    function initMainMenu ( ) {
        const remote = require('electron').remote
        const Menu = remote.Menu
        const MenuItem = remote.MenuItem

        OrchestraAppMenu = Menu.buildFromTemplate( MainMenu )
        Menu.setApplicationMenu( OrchestraAppMenu )
    }

//
// ─── ON MENU DISABLE ────────────────────────────────────────────────────────────
//

    function setMenuEnableFactor ( control ) {
        for ( let menuIndex = 0; menuIndex < OrchestraAppMenu.items.length; menuIndex++ ) {
            let submenu = OrchestraAppMenu.items[ menuIndex ].submenu.items
            for ( let submenuIndex = 0; submenuIndex < submenu.length; submenuIndex++ )
                submenu[ submenuIndex ].enabled = control;
        }
    }

//
// ─── GET VIEW MENU ITEMS ────────────────────────────────────────────────────────
//

    function getViewMenuItems ( ) {
        return OrchestraAppMenu.items[ OrchestraAppMenu.items.length - 3 ]
    }

//
// ─── SET COLOR MODE ACTIVATION ──────────────────────────────────────────────────
//

    function setViewColorModeMenuActivation ( state ) {
        getViewMenuItems( ).submenu.items[ 0 ].checked = state
    }

//
// ─── SET ACTIVE TAB ─────────────────────────────────────────────────────────────
//

    function setActiveTabInMenu ( ) {
        let index = ( CurrentActiveView === 'editor' )? 2 : 3
        getViewMenuItems( ).submenu.items[ index ].checked = true
    }

// ────────────────────────────────────────────────────────────────────────────────
<|endoftext|>


<commit_before>/**
 * @fileoverview Encapsulates the TrafficMap class.
 * @requires Google Maps API
 * @requires jQuery
 */

/**
 * Creates a new Traffic Map.
 * @constructor
 * @param {String} elementId An ID to load the map into.
 */
function TrafficMap (elementId) {
	var self = this;

	var center = new GLatLng(38.56, -121.40);
	var zoom = 10;

	/** The encapsulated Google Map. */
	this.gmap = new GMap2(document.getElementById(elementId));
	this.gmap.setCenter(center, zoom);
	this.gmap.addControl(new GSmallMapControl());

	/** The map center. */
	this.center = center;

	// Save the map's center after a user drag...
	GEvent.addListener(this.gmap, "dragend", function() {
		self.center = self.gmap.getCenter();
	});

	/** Array of live cameras, loaded by {@link load_live_cams}. */
	this.live_cams = [];

	/** Named array of incident markers by ID. */
	this.marker_list = {};

	/**
	 * Loads live cam data from an XML file.
	 * @param {String} cam_url The url of the camera xml file.
	 */
	this.load_live_cams = function (cam_url) {
		jQuery.ajax({
			url: cam_url,
			dataType: "xml",
			success: function (cameras) {
				var camera_markers = [];

				var camera_icon = new GIcon();
				camera_icon.image = "/images/camera_icon.gif";
				camera_icon.iconSize = new GSize(24, 24);
				camera_icon.iconAnchor = new GPoint(12, 12);
				camera_icon.infoWindowAnchor = new GPoint(12, 1);

				for (var x = 0; x < cameras.getElementsByTagName("camera").length; x++) {
					var camera = cameras.getElementsByTagName("camera")[x];
					var marker = make_marker (camera);

					camera_markers.push(marker);
				}

				self.live_cams = camera_markers;
				jQuery(".live_cams").fadeIn("slow");

				// Closure needed to make marker GEvents work right
				function make_marker (camera_dom_node) {
					var id = camera.getAttribute("id");
 					var name = camera.getAttribute("name");
 					var lon = camera.getElementsByTagName("location")[0].getAttribute("lon");
 					var lat = camera.getElementsByTagName("location")[0].getAttribute("lat");
 					var height = camera.getElementsByTagName("size")[0].getAttribute("height");
 					var width = camera.getElementsByTagName("size")[0].getAttribute("width");

					var marker = new GMarker(new GPoint(lon, lat), { title:name, icon:camera_icon });

					GEvent.addListener(marker, "click", function() {
						var ie_safe_name = name.replace(/ /g, "_").replace(/-/g, "_");
						var window_width = parseInt(width) + 60;
						var window_height = parseInt(height) + 170;

						window.open("../showcamera.php?id="+id, ie_safe_name, "width="+window_width+",height="+window_height);
					});

					return marker;
				}
			}
		});
	}

	/**
	 * Shows the live cams.
	 */
	this.show_live_cams = function () {
		for (var x = 0; x < this.live_cams.length; x++) {
			this.gmap.addOverlay(this.live_cams[x]);
		}
	}

	/**
	 * Hides the live cams.
	 */
	this.hide_live_cams = function () {
		for (var x = 0; x < this.live_cams.length; x++) {
			this.gmap.removeOverlay(this.live_cams[x]);
		}
	}

	/**
	 * Shows Google traffic info.
	 */
	this.show_gtraffic = function () {
		/** The Google traffic overlay. */
		this.traffic_overlay = new GTrafficOverlay({incidents:true});
		this.gmap.addOverlay(this.traffic_overlay);
	}

	/**
	 * Hides Google traffic info.
	 */
	this.hide_gtraffic = function () {
		this.gmap.removeOverlay(this.traffic_overlay);
	}

	/**
	 * Centers the map on the given incident ID.
	 * @param {String} incident_id The incident ID to center on.
	 */
	this.center_on_incident = function (incident_id) {
		if (this.marker_list[incident_id]) {
			this.gmap.panTo(this.marker_list[incident_id].getLatLng());
		}
	}

	/**
	 * Update incident data.
	 * @param {object} incidents The incidents object fetched via AJAX.
	 */
	this.update = function (incidents) {
		this.marker_list = {};
		this.gmap.clearOverlays();

		// Put stuff back on the map that should be there
		if (jQuery("input.live_cams").attr('checked')) {
			this.show_live_cams();
		}
		if (jQuery("input.traffic").attr('checked')) {
			this.show_gtraffic();
		}

		for (var x = 0; x < incidents.length; x++) {
			var incident = incidents[x];
			var marker = make_marker (incident);

			if (marker) {
				this.marker_list[incident.ID] = marker;
				this.gmap.addOverlay(marker);
			}
		};

		// Closure needed to make marker GEvents work right
		function make_marker (incident) {
			if (incident.TBXY && incident.TBXY != "") {
				var point = tbxy2latlng(incident.TBXY);
				var latlng = new GLatLng(point.lat, point.lng);

				if (incident.LogType != "Media Information") {
					var incident_icon = ST_DEFAULT_ICON;

					if (/Traffic Hazard|Disabled Vehicle/.test(incident.LogType))
						incident_icon = ST_HAZARD_ICON;
					else if (/Collision/.test(incident.LogType))
						incident_icon = ST_COLLISION_ICON;

					var marker = new GMarker(latlng, {icon: incident_icon});

					GEvent.addListener(marker, "click", function() {
						marker.openInfoWindowHtml(
							'
' + incident.LogType + '
' + incident.Location + '
' + incident.LogTime + '
'
						);
					});

					return marker;
				}
			}
		}
	};

	jQuery(window).unload( function () { GUnload(); } );
}

/** Default incident icon. */
var ST_DEFAULT_ICON = new GIcon(G_DEFAULT_ICON);
ST_DEFAULT_ICON.image = "/images/incident.png";
ST_DEFAULT_ICON.shadow = "/images/traffic_incident_shadow.png";
ST_DEFAULT_ICON.iconSize = new GSize(18, 18);
ST_DEFAULT_ICON.shadowSize = new GSize(23, 23);
ST_DEFAULT_ICON.iconAnchor = new GPoint(9, 9);
ST_DEFAULT_ICON.infoWindowAnchor = new GPoint(8, 3);

/** Default hazard icon. */
var ST_HAZARD_ICON = new GIcon(ST_DEFAULT_ICON);

/** Default collision icon. */
var ST_COLLISION_ICON = new GIcon(ST_DEFAULT_ICON);
ST_COLLISION_ICON.image = "/images/accident.png";
<commit_msg>Put the CHP incidents *under* everything else because everything else can be turned off.  This way the CHP incidents don't block access to the cameras or Google icons.<commit_after>/**
 * @fileoverview Encapsulates the TrafficMap class.
 * @requires Google Maps API
 * @requires jQuery
 */

/**
 * Creates a new Traffic Map.
 * @constructor
 * @param {String} elementId An ID to load the map into.
 */
function TrafficMap (elementId) {
	var self = this;

	var center = new GLatLng(38.56, -121.40);
	var zoom = 10;

	/** The encapsulated Google Map. */
	this.gmap = new GMap2(document.getElementById(elementId));
	this.gmap.setCenter(center, zoom);
	this.gmap.addControl(new GSmallMapControl());

	/** The map center. */
	this.center = center;

	// Save the map's center after a user drag...
	GEvent.addListener(this.gmap, "dragend", function() {
		self.center = self.gmap.getCenter();
	});

	/** Array of live cameras, loaded by {@link load_live_cams}. */
	this.live_cams = [];

	/** Named array of incident markers by ID. */
	this.marker_list = {};

	/**
	 * Loads live cam data from an XML file.
	 * @param {String} cam_url The url of the camera xml file.
	 */
	this.load_live_cams = function (cam_url) {
		jQuery.ajax({
			url: cam_url,
			dataType: "xml",
			success: function (cameras) {
				var camera_markers = [];

				var camera_icon = new GIcon();
				camera_icon.image = "/images/camera_icon.gif";
				camera_icon.iconSize = new GSize(24, 24);
				camera_icon.iconAnchor = new GPoint(12, 12);
				camera_icon.infoWindowAnchor = new GPoint(12, 1);

				for (var x = 0; x < cameras.getElementsByTagName("camera").length; x++) {
					var camera = cameras.getElementsByTagName("camera")[x];
					var marker = make_marker (camera);

					camera_markers.push(marker);
				}

				self.live_cams = camera_markers;
				jQuery(".live_cams").fadeIn("slow");

				// Closure needed to make marker GEvents work right
				function make_marker (camera_dom_node) {
					var id = camera.getAttribute("id");
 					var name = camera.getAttribute("name");
 					var lon = camera.getElementsByTagName("location")[0].getAttribute("lon");
 					var lat = camera.getElementsByTagName("location")[0].getAttribute("lat");
 					var height = camera.getElementsByTagName("size")[0].getAttribute("height");
 					var width = camera.getElementsByTagName("size")[0].getAttribute("width");

					var marker = new GMarker(new GPoint(lon, lat), { title:name, icon:camera_icon });

					GEvent.addListener(marker, "click", function() {
						var ie_safe_name = name.replace(/ /g, "_").replace(/-/g, "_");
						var window_width = parseInt(width) + 60;
						var window_height = parseInt(height) + 170;

						window.open("../showcamera.php?id="+id, ie_safe_name, "width="+window_width+",height="+window_height);
					});

					return marker;
				}
			}
		});
	}

	/**
	 * Shows the live cams.
	 */
	this.show_live_cams = function () {
		for (var x = 0; x < this.live_cams.length; x++) {
			this.gmap.addOverlay(this.live_cams[x]);
		}
	}

	/**
	 * Hides the live cams.
	 */
	this.hide_live_cams = function () {
		for (var x = 0; x < this.live_cams.length; x++) {
			this.gmap.removeOverlay(this.live_cams[x]);
		}
	}

	/**
	 * Shows Google traffic info.
	 */
	this.show_gtraffic = function () {
		/** The Google traffic overlay. */
		this.traffic_overlay = new GTrafficOverlay({incidents:true});
		this.gmap.addOverlay(this.traffic_overlay);
	}

	/**
	 * Hides Google traffic info.
	 */
	this.hide_gtraffic = function () {
		this.gmap.removeOverlay(this.traffic_overlay);
	}

	/**
	 * Centers the map on the given incident ID.
	 * @param {String} incident_id The incident ID to center on.
	 */
	this.center_on_incident = function (incident_id) {
		if (this.marker_list[incident_id]) {
			this.gmap.panTo(this.marker_list[incident_id].getLatLng());
		}
	}

	/**
	 * Update incident data.
	 * @param {object} incidents The incidents object fetched via AJAX.
	 */
	this.update = function (incidents) {
		this.marker_list = {};
		this.gmap.clearOverlays();

		// Put stuff back on the map that should be there
		if (jQuery("input.live_cams").attr('checked')) {
			this.show_live_cams();
		}
		if (jQuery("input.traffic").attr('checked')) {
			this.show_gtraffic();
		}

		for (var x = 0; x < incidents.length; x++) {
			var incident = incidents[x];
			var marker = make_marker (incident);

			if (marker) {
				this.marker_list[incident.ID] = marker;
				this.gmap.addOverlay(marker);
			}
		};

		// Closure needed to make marker GEvents work right
		function make_marker (incident) {
			if (incident.TBXY && incident.TBXY != "") {
				var point = tbxy2latlng(incident.TBXY);
				var latlng = new GLatLng(point.lat, point.lng);

				if (incident.LogType != "Media Information") {
					var incident_icon = ST_DEFAULT_ICON;

					if (/Traffic Hazard|Disabled Vehicle/.test(incident.LogType))
						incident_icon = ST_HAZARD_ICON;
					else if (/Collision/.test(incident.LogType))
						incident_icon = ST_COLLISION_ICON;

					var marker = new GMarker(latlng, {
						icon: incident_icon,
						zIndexProcess: function () {
							// Put the CHP incidents *under* everything else because everything
							// else can be turned off to get it out of the way.
							return GOverlay.getZIndex(latlng.lat()) * 2;
						}
					});

					GEvent.addListener(marker, "click", function() {
						marker.openInfoWindowHtml(
							'
' + incident.LogType + '
' + incident.Location + '
' + incident.LogTime + '
'
						);
					});

					return marker;
				}
			}
		}
	};

	jQuery(window).unload( function () { GUnload(); } );
}

/** Default incident icon. */
var ST_DEFAULT_ICON = new GIcon(G_DEFAULT_ICON);
ST_DEFAULT_ICON.image = "/images/incident.png";
ST_DEFAULT_ICON.shadow = "/images/traffic_incident_shadow.png";
ST_DEFAULT_ICON.iconSize = new GSize(18, 18);
ST_DEFAULT_ICON.shadowSize = new GSize(23, 23);
ST_DEFAULT_ICON.iconAnchor = new GPoint(9, 9);
ST_DEFAULT_ICON.infoWindowAnchor = new GPoint(8, 3);

/** Default hazard icon. */
var ST_HAZARD_ICON = new GIcon(ST_DEFAULT_ICON);

/** Default collision icon. */
var ST_COLLISION_ICON = new GIcon(ST_DEFAULT_ICON);
ST_COLLISION_ICON.image = "/images/accident.png";
<|endoftext|>


<commit_before>var Promise = require('bluebird');
var shell = require('shelljs');

function pdftohtml (filename, outfile, options) {
  this.options = options || {};
  this.options.additional = [filename];
  if (typeof outfile !== "undefined" && outfile !== null) {
    this.options.additional.push(outfile);
  }

  pdftohtml.prototype._preset = function(preset) {
    try {
      var module = require('./presets/' + preset);
      if (typeof module.load === 'function') {
        module.load(this);
      }
      return this;
    }
    catch (err) {
      try {
        var module = require(preset);
        if (typeof module.load === 'function') {
          module.load(this);
        }
        return this;
      }
      catch (err) {
        //pass
      }
    }
    throw new Error('preset ' + preset + ' could not be loaded');
  };

  pdftohtml.prototype.add_options = function(optionArray) {
    if (typeof optionArray.length !== undefined) {
        var self = this;
        optionArray.forEach(function(el) {
          var firstSpace = el.indexOf(' ');
          if (firstSpace > 0) {
            var param = el.substr(0, firstSpace);
            var val = el.substr(firstSpace + 1).replace(/ /g, "\\ ");
            self.options.additional.push(param, val);
          } else {
            self.options.additional.push(el);
          }
        });
    }
    return this;
  };

  pdftohtml.prototype.convert = function(preset) {
    var preset = preset || "default";
    var self = this;
    self.options.bin = self.options.bin || 'pdf2htmlEX';

    return new Promise(function (resolve, reject) {
      self._preset(preset);
      var child = shell.exec(self.options.bin + ' ' + self.options.additional.join(' '), {async:true, silent:true});

      var error = '';

      child.stdout.on('data', function(data){
        // pdf2htmlEX writes out to stderr
      });

      child.stderr.on('data', function(data){
        error += data;
        if (self.options.progress
              && typeof self.options.progress === "function") {
          var lastLine = data.split(/\r\n|\r|\n/g);
          var ll = lastLine[lastLine.length - 2];
          var progress;
          if (ll) {
            progress = ll.split(/Working\: ([0-9\d]+)\/([0-9\d]+)/ig);
          }
          if (progress && progress.length > 1) {
            // build progress report object
            var ret = {
              current: parseInt(progress[1]),
              total: parseInt(progress[2])
            };
            self.options.progress(ret);
          }
        }
      });

      child.on('exit', function(code, signal){
        if (code === 0) {
          resolve();
        } else {
          if (!shell.which('pdf2htmlEX')) {
            shell.echo('Sorry, this script requires pdf2htmlEX.');
            shell.echo('Install it from http://github.com/coolwanglu/pdf2htmlEX');
            reject("Please install pdf2htmlEX");
          }
          reject({code: code, signal: signal});
        }
      });
    });
  };

  pdftohtml.prototype.progress = function(callback) {
    this.options.progress = callback;
    return this;
  };

}

// module exports
exports = module.exports = function(filename, outfile, options) {
  return new pdftohtml(filename, outfile, options);
};

<commit_msg>Pass Pdftohtml Child Process Output<commit_after>var Promise = require('bluebird');
var shell = require('shelljs');

function pdftohtml (filename, outfile, options) {
  this.options = options || {};
  this.options.additional = [filename];
  if (typeof outfile !== "undefined" && outfile !== null) {
    this.options.additional.push(outfile);
  }

  pdftohtml.prototype._preset = function(preset) {
    try {
      var module = require('./presets/' + preset);
      if (typeof module.load === 'function') {
        module.load(this);
      }
      return this;
    }
    catch (err) {
      try {
        var module = require(preset);
        if (typeof module.load === 'function') {
          module.load(this);
        }
        return this;
      }
      catch (err) {
        //pass
      }
    }
    throw new Error('preset ' + preset + ' could not be loaded');
  };

  pdftohtml.prototype.add_options = function(optionArray) {
    if (typeof optionArray.length !== undefined) {
        var self = this;
        optionArray.forEach(function(el) {
          var firstSpace = el.indexOf(' ');
          if (firstSpace > 0) {
            var param = el.substr(0, firstSpace);
            var val = el.substr(firstSpace + 1).replace(/ /g, "\\ ");
            self.options.additional.push(param, val);
          } else {
            self.options.additional.push(el);
          }
        });
    }
    return this;
  };

  pdftohtml.prototype.convert = function(preset) {
    var preset = preset || "default";
    var self = this;
    self.options.bin = self.options.bin || 'pdf2htmlEX';

    return new Promise(function (resolve, reject) {
      self._preset(preset);
      var child = shell.exec(self.options.bin + ' ' + self.options.additional.join(' '), {async:true, silent:true});

      var error = '';

      child.stdout.on('data', function(data){
        // pdf2htmlEX writes out to stderr
      });

      child.stderr.on('data', function(data){
        error += data;
        if (self.options.progress
              && typeof self.options.progress === "function") {
          var lastLine = data.split(/\r\n|\r|\n/g);
          var ll = lastLine[lastLine.length - 2];
          var progress;
          if (ll) {
            progress = ll.split(/Working\: ([0-9\d]+)\/([0-9\d]+)/ig);
          }
          if (progress && progress.length > 1) {
            // build progress report object
            var ret = {
              current: parseInt(progress[1]),
              total: parseInt(progress[2])
            };
            self.options.progress(ret);
          }
        }
      });

      child.on('exit', function(code, signal){
        if (code === 0) {
          resolve(error);
        } else {
          if (!shell.which('pdf2htmlEX')) {
            shell.echo('Sorry, this script requires pdf2htmlEX.');
            shell.echo('Install it from http://github.com/coolwanglu/pdf2htmlEX');
            reject("Please install pdf2htmlEX");
          }
          reject({code: code, signal: signal});
        }
      });
    });
  };

  pdftohtml.prototype.progress = function(callback) {
    this.options.progress = callback;
    return this;
  };

}

// module exports
exports = module.exports = function(filename, outfile, options) {
  return new pdftohtml(filename, outfile, options);
};

<|endoftext|>


<commit_before>import PropTypes from 'prop-types'
import React, { Component } from 'react'
import {
  Button,
  Container,
  Divider,
  Grid,
  Header,
  Icon,
  Image,
  List,
  Menu,
  Responsive,
  Segment,
  Sidebar,
  Visibility,
} from 'semantic-ui-react'

/* eslint-disable react/no-multi-comp */
/* Heads up! HomepageHeading uses inline styling, however it's not the best practice. Use CSS or styled components for
 * such things.
 */
const HomepageHeading = ({ mobile }) => (
  <Container text>

    <Button primary size='huge'>
      Get Started
      <Icon name='right arrow' />
    </Button>
  </Container>
)

HomepageHeading.propTypes = {
  mobile: PropTypes.bool,
}

/* Heads up!
 * Neither Semantic UI nor Semantic UI React offer a responsive navbar, however, it can be implemented easily.
 * It can be more complicated, but you can create really flexible markup.
 */
class DesktopContainer extends Component {
  state = {}

  hideFixedMenu = () => this.setState({ fixed: false })
  showFixedMenu = () => this.setState({ fixed: true })

  render() {
    const { children } = this.props
    const { fixed } = this.state

    return (
      <Responsive {...Responsive.onlyComputer}>
        <Visibility
          once={false}
          onBottomPassed={this.showFixedMenu}
          onBottomPassedReverse={this.hideFixedMenu}
        >
          <Segment
            inverted
            textAlign='center'
            style={{ minHeight: 700, padding: '1em 0em' }}
            vertical
          >
            <Menu
              fixed={fixed ? 'top' : null}
              inverted={!fixed}
              pointing={!fixed}
              secondary={!fixed}
              size='large'
            >
              <Container>
                <Menu.Item as='a' active>
                  Home
                </Menu.Item>
                <Menu.Item as='a'>Work</Menu.Item>
                <Menu.Item as='a'>Company</Menu.Item>
                <Menu.Item as='a'>Careers</Menu.Item>
                <Menu.Item position='right'>
                  <Button as='a' inverted={!fixed}>
                    Log in
                  </Button>
                  <Button as='a' inverted={!fixed} primary={fixed} style={{ marginLeft: '0.5em' }}>
                    Sign Up
                  </Button>
                </Menu.Item>
              </Container>
            </Menu>
            <HomepageHeading />
          </Segment>
        </Visibility>

        {children}
      </Responsive>
    )
  }
}

DesktopContainer.propTypes = {
  children: PropTypes.node,
}

class MobileContainer extends Component {
  state = {}

  handlePusherClick = () => {
    const { sidebarOpened } = this.state

    if (sidebarOpened) this.setState({ sidebarOpened: false })
  }

  handleToggle = () => this.setState({ sidebarOpened: !this.state.sidebarOpened })

  render() {
    const { children } = this.props
    const { sidebarOpened } = this.state

    return (
      <Responsive {...Responsive.onlyMobile}>
        <Sidebar.Pushable>
          <Sidebar as={Menu} animation='uncover' inverted vertical visible={sidebarOpened}>
            <Menu.Item as='a' active>
              Home
            </Menu.Item>
            <Menu.Item as='a'>Work</Menu.Item>
            <Menu.Item as='a'>Company</Menu.Item>
            <Menu.Item as='a'>Careers</Menu.Item>
            <Menu.Item as='a'>Log in</Menu.Item>
            <Menu.Item as='a'>Sign Up</Menu.Item>
          </Sidebar>

          <Sidebar.Pusher
            dimmed={sidebarOpened}
            onClick={this.handlePusherClick}
            style={{ minHeight: '100vh' }}
          >
            <Segment
              inverted
              textAlign='center'
              style={{ minHeight: 350, padding: '1em 0em' }}
              vertical
            >
              <Container>
                <Menu inverted pointing secondary size='large'>
                  <Menu.Item onClick={this.handleToggle}>
                    <Icon name='sidebar' />
                  </Menu.Item>
                  <Menu.Item position='right'>
                    <Button as='a' inverted>
                      Log in
                    </Button>
                    <Button as='a' inverted style={{ marginLeft: '0.5em' }}>
                      Sign Up
                    </Button>
                  </Menu.Item>
                </Menu>
              </Container>
              <HomepageHeading mobile />
            </Segment>

            {children}
          </Sidebar.Pusher>
        </Sidebar.Pushable>
      </Responsive>
    )
  }
}

MobileContainer.propTypes = {
  children: PropTypes.node,
}

const ResponsiveContainer = ({ children }) => (

    <DesktopContainer>{children}</DesktopContainer>
    <MobileContainer>{children}</MobileContainer>

)

ResponsiveContainer.propTypes = {
  children: PropTypes.node,
}

const HomepageLayout = () => (
  <ResponsiveContainer>
    <Segment style={{ padding: '8em 0em' }} vertical>
      <Grid container stackable verticalAlign='middle'>
        <Grid.Row>
          <Grid.Column width={8}>

              We Help Companies and Companions

              We can give your company superpowers to do things that they never thought possible.
              Let us delight your customers and empower your needs... through pure data analytics.

              We Make Bananas That Can Dance

              Yes that's right, you thought it was the stuff of dreams, but even bananas can be
              bioengineered.

          </Grid.Column>
          <Grid.Column floated='right' width={6}>
            <Image bordered rounded size='large' src='/images/wireframe/white-image.png' />
          </Grid.Column>
        </Grid.Row>
        <Grid.Row>
          <Grid.Column textAlign='center'>
            <Button size='huge'>Check Them Out</Button>
          </Grid.Column>
        </Grid.Row>
      </Grid>
    </Segment>

    <Segment style={{ padding: '0em' }} vertical>
      <Grid celled='internally' columns='equal' stackable>
        <Grid.Row textAlign='center'>
          <Grid.Column style={{ paddingBottom: '5em', paddingTop: '5em' }}>

              "What a Company"

That is what they all say about us

          </Grid.Column>
          <Grid.Column style={{ paddingBottom: '5em', paddingTop: '5em' }}>

              "I shouldn't have gone with their competitor."

              <Image avatar src='/images/avatar/large/nan.jpg' />
              Nan Chief Fun Officer Acme Toys

          </Grid.Column>
        </Grid.Row>
      </Grid>
    </Segment>

    <Segment style={{ padding: '8em 0em' }} vertical>
      <Container text>

          Breaking The Grid, Grabs Your Attention

          Instead of focusing on content creation and hard work, we have learned how to master the
          art of doing nothing by providing massive amounts of whitespace and generic content that
          can seem massive, monolithic and worth your attention.

        <Button as='a' size='large'>
          Read More
        </Button>

        <Divider
          as='h4'
          className='header'
          horizontal
          style={{ margin: '3em 0em', textTransform: 'uppercase' }}
        >
          Case Studies
        </Divider>

          Did We Tell You About Our Bananas?

          Yes I know you probably disregarded the earlier boasts as non-sequitur filler content, but
          it's really true. It took years of gene splicing and combinatory DNA research, but our
          bananas can really dance.

        <Button as='a' size='large'>
          I'm Still Quite Interested
        </Button>
      </Container>
    </Segment>

    <Segment inverted vertical style={{ padding: '5em 0em' }}>
      <Container>
        <Grid divided inverted stackable>
          <Grid.Row>
            <Grid.Column width={3}>

              <List link inverted>
                <List.Item as='a'>Sitemap</List.Item>
                <List.Item as='a'>Contact Us</List.Item>
                <List.Item as='a'>Religious Ceremonies</List.Item>
                <List.Item as='a'>Gazebo Plans</List.Item>
              </List>
            </Grid.Column>
            <Grid.Column width={3}>

              <List link inverted>
                <List.Item as='a'>Banana Pre-Order</List.Item>
                <List.Item as='a'>DNA FAQ</List.Item>
                <List.Item as='a'>How To Access</List.Item>
                <List.Item as='a'>Favorite X-Men</List.Item>
              </List>
            </Grid.Column>
            <Grid.Column width={7}>

                Footer Header

                Extra space for a call to action inside the footer that could help re-engage users.

            </Grid.Column>
          </Grid.Row>
        </Grid>
      </Container>
    </Segment>
  </ResponsiveContainer>
)

export default HomepageLayout
<commit_msg>docs(Layouts): fix size variables in HomepageLayout (#3014)<commit_after>import PropTypes from 'prop-types'
import React, { Component } from 'react'
import {
  Button,
  Container,
  Divider,
  Grid,
  Header,
  Icon,
  Image,
  List,
  Menu,
  Responsive,
  Segment,
  Sidebar,
  Visibility,
} from 'semantic-ui-react'

/* eslint-disable react/no-multi-comp */
/* Heads up! HomepageHeading uses inline styling, however it's not the best practice. Use CSS or styled components for
 * such things.
 */
const HomepageHeading = ({ mobile }) => (
  <Container text>

    <Button primary size='huge'>
      Get Started
      <Icon name='right arrow' />
    </Button>
  </Container>
)

HomepageHeading.propTypes = {
  mobile: PropTypes.bool,
}

/* Heads up!
 * Neither Semantic UI nor Semantic UI React offer a responsive navbar, however, it can be implemented easily.
 * It can be more complicated, but you can create really flexible markup.
 */
class DesktopContainer extends Component {
  state = {}

  hideFixedMenu = () => this.setState({ fixed: false })
  showFixedMenu = () => this.setState({ fixed: true })

  render() {
    const { children } = this.props
    const { fixed } = this.state

    return (
      <Responsive minWidth={Responsive.onlyTablet.minWidth}>
        <Visibility
          once={false}
          onBottomPassed={this.showFixedMenu}
          onBottomPassedReverse={this.hideFixedMenu}
        >
          <Segment
            inverted
            textAlign='center'
            style={{ minHeight: 700, padding: '1em 0em' }}
            vertical
          >
            <Menu
              fixed={fixed ? 'top' : null}
              inverted={!fixed}
              pointing={!fixed}
              secondary={!fixed}
              size='large'
            >
              <Container>
                <Menu.Item as='a' active>
                  Home
                </Menu.Item>
                <Menu.Item as='a'>Work</Menu.Item>
                <Menu.Item as='a'>Company</Menu.Item>
                <Menu.Item as='a'>Careers</Menu.Item>
                <Menu.Item position='right'>
                  <Button as='a' inverted={!fixed}>
                    Log in
                  </Button>
                  <Button as='a' inverted={!fixed} primary={fixed} style={{ marginLeft: '0.5em' }}>
                    Sign Up
                  </Button>
                </Menu.Item>
              </Container>
            </Menu>
            <HomepageHeading />
          </Segment>
        </Visibility>

        {children}
      </Responsive>
    )
  }
}

DesktopContainer.propTypes = {
  children: PropTypes.node,
}

class MobileContainer extends Component {
  state = {}

  handlePusherClick = () => {
    const { sidebarOpened } = this.state

    if (sidebarOpened) this.setState({ sidebarOpened: false })
  }

  handleToggle = () => this.setState({ sidebarOpened: !this.state.sidebarOpened })

  render() {
    const { children } = this.props
    const { sidebarOpened } = this.state

    return (
      <Responsive maxWidth={Responsive.onlyMobile.maxWidth}>
        <Sidebar.Pushable>
          <Sidebar as={Menu} animation='uncover' inverted vertical visible={sidebarOpened}>
            <Menu.Item as='a' active>
              Home
            </Menu.Item>
            <Menu.Item as='a'>Work</Menu.Item>
            <Menu.Item as='a'>Company</Menu.Item>
            <Menu.Item as='a'>Careers</Menu.Item>
            <Menu.Item as='a'>Log in</Menu.Item>
            <Menu.Item as='a'>Sign Up</Menu.Item>
          </Sidebar>

          <Sidebar.Pusher
            dimmed={sidebarOpened}
            onClick={this.handlePusherClick}
            style={{ minHeight: '100vh' }}
          >
            <Segment
              inverted
              textAlign='center'
              style={{ minHeight: 350, padding: '1em 0em' }}
              vertical
            >
              <Container>
                <Menu inverted pointing secondary size='large'>
                  <Menu.Item onClick={this.handleToggle}>
                    <Icon name='sidebar' />
                  </Menu.Item>
                  <Menu.Item position='right'>
                    <Button as='a' inverted>
                      Log in
                    </Button>
                    <Button as='a' inverted style={{ marginLeft: '0.5em' }}>
                      Sign Up
                    </Button>
                  </Menu.Item>
                </Menu>
              </Container>
              <HomepageHeading mobile />
            </Segment>

            {children}
          </Sidebar.Pusher>
        </Sidebar.Pushable>
      </Responsive>
    )
  }
}

MobileContainer.propTypes = {
  children: PropTypes.node,
}

const ResponsiveContainer = ({ children }) => (

    <DesktopContainer>{children}</DesktopContainer>
    <MobileContainer>{children}</MobileContainer>

)

ResponsiveContainer.propTypes = {
  children: PropTypes.node,
}

const HomepageLayout = () => (
  <ResponsiveContainer>
    <Segment style={{ padding: '8em 0em' }} vertical>
      <Grid container stackable verticalAlign='middle'>
        <Grid.Row>
          <Grid.Column width={8}>

              We Help Companies and Companions

              We can give your company superpowers to do things that they never thought possible.
              Let us delight your customers and empower your needs... through pure data analytics.

              We Make Bananas That Can Dance

              Yes that's right, you thought it was the stuff of dreams, but even bananas can be
              bioengineered.

          </Grid.Column>
          <Grid.Column floated='right' width={6}>
            <Image bordered rounded size='large' src='/images/wireframe/white-image.png' />
          </Grid.Column>
        </Grid.Row>
        <Grid.Row>
          <Grid.Column textAlign='center'>
            <Button size='huge'>Check Them Out</Button>
          </Grid.Column>
        </Grid.Row>
      </Grid>
    </Segment>

    <Segment style={{ padding: '0em' }} vertical>
      <Grid celled='internally' columns='equal' stackable>
        <Grid.Row textAlign='center'>
          <Grid.Column style={{ paddingBottom: '5em', paddingTop: '5em' }}>

              "What a Company"

That is what they all say about us

          </Grid.Column>
          <Grid.Column style={{ paddingBottom: '5em', paddingTop: '5em' }}>

              "I shouldn't have gone with their competitor."

              <Image avatar src='/images/avatar/large/nan.jpg' />
              Nan Chief Fun Officer Acme Toys

          </Grid.Column>
        </Grid.Row>
      </Grid>
    </Segment>

    <Segment style={{ padding: '8em 0em' }} vertical>
      <Container text>

          Breaking The Grid, Grabs Your Attention

          Instead of focusing on content creation and hard work, we have learned how to master the
          art of doing nothing by providing massive amounts of whitespace and generic content that
          can seem massive, monolithic and worth your attention.

        <Button as='a' size='large'>
          Read More
        </Button>

        <Divider
          as='h4'
          className='header'
          horizontal
          style={{ margin: '3em 0em', textTransform: 'uppercase' }}
        >
          Case Studies
        </Divider>

          Did We Tell You About Our Bananas?

          Yes I know you probably disregarded the earlier boasts as non-sequitur filler content, but
          it's really true. It took years of gene splicing and combinatory DNA research, but our
          bananas can really dance.

        <Button as='a' size='large'>
          I'm Still Quite Interested
        </Button>
      </Container>
    </Segment>

    <Segment inverted vertical style={{ padding: '5em 0em' }}>
      <Container>
        <Grid divided inverted stackable>
          <Grid.Row>
            <Grid.Column width={3}>

              <List link inverted>
                <List.Item as='a'>Sitemap</List.Item>
                <List.Item as='a'>Contact Us</List.Item>
                <List.Item as='a'>Religious Ceremonies</List.Item>
                <List.Item as='a'>Gazebo Plans</List.Item>
              </List>
            </Grid.Column>
            <Grid.Column width={3}>

              <List link inverted>
                <List.Item as='a'>Banana Pre-Order</List.Item>
                <List.Item as='a'>DNA FAQ</List.Item>
                <List.Item as='a'>How To Access</List.Item>
                <List.Item as='a'>Favorite X-Men</List.Item>
              </List>
            </Grid.Column>
            <Grid.Column width={7}>

                Footer Header

                Extra space for a call to action inside the footer that could help re-engage users.

            </Grid.Column>
          </Grid.Row>
        </Grid>
      </Container>
    </Segment>
  </ResponsiveContainer>
)

export default HomepageLayout
<|endoftext|>


<commit_before>(function () {
  'use strict';

  var fs = require('fs'),
      util = require('util'),
      repl = require('repl'),
      jsdom = require('jsdom'),
      html = '',
      Table = require('cli-table'),
      XMLHttpRequest = require('xmlhttprequest');

  console.log("     _ _                   _                             _       ");
  console.log("  __| | |       __ _ _ __ (_)   ___ ___  _ __  ___  ___ | | ___  ");
  console.log(" / _` | |_____ / _` | '_ \\| |  / __/ _ \\| '_ \\/ __|/ _ \\| |/ _ \\ ");
  console.log("| (_| | |_____| (_| | |_) | | | (_| (_) | | | \\__ \\ (_) | |  __/ ");
  console.log(" \\__,_|_|      \\__,_| .__/|_|  \\___\\___/|_| |_|___/\\___/|_|\\___| ");
  console.log("                    |_|                                          ");
  console.log("");
  process.stdout.write("Loading...");

  // first argument can be html string, filename, or url
  jsdom.env(html, ["https://dl-api.ddll.co/dist/dl.js"], function (errors, window) {
    console.log("\rWelcome to dl-api console.");
    console.log("API Documentation: http://doubleleft.github.io/dl-api-javascript\n");
    console.log("Available variables to hack on:");
    console.log("\t- dl (DL.Client)");
    console.log("\t- config (.dl-config)");
    console.log("\t- window");

    function CollectionInspector(promise, options) {
      this.promise = promise;
      this.options = options;
    }

    function writer(obj) {
      var that = this;
      if (obj.constructor.name == "CollectionInspector") {
        obj.promise.then(function(data) {
          if (data.length && data.length > 0) {
            delete data[0].app_id;

            if (!obj.options.timestamps) {
              delete data[0].created_at;
              delete data[0].updated_at;
            }

            var keys = Object.keys(data[0]),
                table = new Table({ head: keys });

            for (var i=0; i < data.length; i++) {
              delete data[i].app_id;

              if (!obj.options.timestamps) {
                delete data[i].created_at;
                delete data[i].updated_at;
              }

              var values = [];
              for (var k in data[i]) {
                values.push(util.inspect(data[i][k], {colors: true}));
              }
              table.push(values);
            }

            //
            // FIXME: update buffer instantly.
            // sometimes it outputs only after some RETURN key press.
            //
            that.outputStream.write("\n" + table.toString() + "\n");
            that.displayPrompt();
          } else if (data.lengh == 0) {
            that.outputStream.write("\nEmpty.\n");
          } else {
            that.outputStream.write("\n" + util.inspect(data, {colors: true}) + "\n");
          }
        }, function(data) {
          that.outputStream.write("\n"+util.inspect(data, {colors: true})+"\n");
        });
        return '[ Querying result... ]';
      } else {
        return util.inspect(obj, {colors: true});
      }
    }

    var $ = require('jquery')(window),
        sess = repl.start({
          prompt: 'dl-api> ',
          writer: writer,
          ignoreUndefined: true
        }),
        config = JSON.parse(fs.readFileSync(process.argv[2]));

    // dummy localstorage
    window.localStorage = {
      _items: {},
      getItem: function(name) { return this._items[name]; },
      setItem: function(name, value) { this._items[name] = value; }
    };

    //
    // TODO: always use the same coding style for this
    //
    config.appId = config.app_id;
    delete config.app_id;

    config.url = config.endpoint;
    delete config.endpoint;

    window.DL.Collection.prototype.inspect = function(options) {
      if (!options) { options = {}; }
      // TOOD: add 'fields' option, allowing to filter specific fields to display on table

      // Show timestamps by default
      if (typeof(options.timestamps) === "undefined") {
        options.timestamps = true;
      }

      return new CollectionInspector(this.then(), options);
    };

    //
    // Custom inspecting
    //
    // window.DL.Collection.prototype.inspect = function() {
    //   return "[Collection: '" + this.name + "']";
    // };

    sess.context.window = window;
    sess.context.$ = window.$;
    sess.context.DL = window.DL;
    sess.context.config = config;
    sess.context.dl = new window.DL.Client(config);
    sess.context.sess = sess;

  });
}());
<commit_msg>update console available variable instructions<commit_after>(function () {
  'use strict';

  var fs = require('fs'),
      util = require('util'),
      repl = require('repl'),
      jsdom = require('jsdom'),
      html = '',
      Table = require('cli-table'),
      XMLHttpRequest = require('xmlhttprequest');

  console.log("     _ _                   _                             _       ");
  console.log("  __| | |       __ _ _ __ (_)   ___ ___  _ __  ___  ___ | | ___  ");
  console.log(" / _` | |_____ / _` | '_ \\| |  / __/ _ \\| '_ \\/ __|/ _ \\| |/ _ \\ ");
  console.log("| (_| | |_____| (_| | |_) | | | (_| (_) | | | \\__ \\ (_) | |  __/ ");
  console.log(" \\__,_|_|      \\__,_| .__/|_|  \\___\\___/|_| |_|___/\\___/|_|\\___| ");
  console.log("                    |_|                                          ");
  console.log("");
  process.stdout.write("Loading...");

  // first argument can be html string, filename, or url
  jsdom.env(html, ["https://dl-api.ddll.co/dist/dl.js"], function (errors, window) {
    console.log("\rAPI Documentation: http://doubleleft.github.io/dl-api-javascript\n");
    console.log("Available variables to hack on:");
    console.log("\t- dl - DL.Client");
    console.log("\t- config - .dl-config");
    console.log("\t- $ - jQuery 2.1.0");
    console.log("\t- window");

    function CollectionInspector(promise, options) {
      this.promise = promise;
      this.options = options;
    }

    function writer(obj) {
      var that = this;
      if (obj.constructor.name == "CollectionInspector") {
        obj.promise.then(function(data) {
          if (data.length && data.length > 0) {
            delete data[0].app_id;

            if (!obj.options.timestamps) {
              delete data[0].created_at;
              delete data[0].updated_at;
            }

            var keys = Object.keys(data[0]),
                table = new Table({ head: keys });

            for (var i=0; i < data.length; i++) {
              delete data[i].app_id;

              if (!obj.options.timestamps) {
                delete data[i].created_at;
                delete data[i].updated_at;
              }

              var values = [];
              for (var k in data[i]) {
                values.push(util.inspect(data[i][k], {colors: true}));
              }
              table.push(values);
            }

            //
            // FIXME: update buffer instantly.
            // sometimes it outputs only after some RETURN key press.
            //
            that.outputStream.write("\n" + table.toString() + "\n");
            that.displayPrompt();
          } else if (data.lengh == 0) {
            that.outputStream.write("\nEmpty.\n");
          } else {
            that.outputStream.write("\n" + util.inspect(data, {colors: true}) + "\n");
          }
        }, function(data) {
          that.outputStream.write("\n"+util.inspect(data, {colors: true})+"\n");
        });
        return '[ Querying result... ]';
      } else {
        return util.inspect(obj, {colors: true});
      }
    }

    var $ = require('jquery')(window),
        sess = repl.start({
          prompt: 'dl-api> ',
          writer: writer,
          ignoreUndefined: true
        }),
        config = JSON.parse(fs.readFileSync(process.argv[2]));

    // dummy localstorage
    window.localStorage = {
      _items: {},
      getItem: function(name) { return this._items[name]; },
      setItem: function(name, value) { this._items[name] = value; }
    };

    //
    // TODO: always use the same coding style for this
    //
    config.appId = config.app_id;
    delete config.app_id;

    config.url = config.endpoint;
    delete config.endpoint;

    window.DL.Collection.prototype.inspect = function(options) {
      if (!options) { options = {}; }
      // TOOD: add 'fields' option, allowing to filter specific fields to display on table

      // Show timestamps by default
      if (typeof(options.timestamps) === "undefined") {
        options.timestamps = true;
      }

      return new CollectionInspector(this.then(), options);
    };

    //
    // Custom inspecting
    //
    // window.DL.Collection.prototype.inspect = function() {
    //   return "[Collection: '" + this.name + "']";
    // };

    sess.context.window = window;
    sess.context.$ = window.$;
    sess.context.DL = window.DL;
    sess.context.config = config;
    sess.context.dl = new window.DL.Client(config);
    sess.context.sess = sess;

  });
}());
<|endoftext|>


<commit_before>'use strict';

var imageToSlices = require('../lib/index');
//var imageToSlices = require('image-to-slices');

var lineXArray = [60, 250];
var lineYArray = [100, 200];
var source = './images/building.png';

imageToSlices(source, lineXArray, lineYArray, {
  saveToDataUrl: true
}, function(dataUrlList) {
  console.log('sliced', dataUrlList);
  var result = document.getElementById('result');
  pushDataURI(300, 300, dataUrlList, result);
});

function pushDataURI(width, height, list, parent) {
  parent = parent || document.body;

  var div = document.createElement('div');
  div.style.width = width + 30 + 'px';
  div.style.height = height + 'px';
  div.setAttribute('class', 'imageWrapper');

  parent.appendChild(div);

  list.forEach(function(item, index) {
    var div2 = document.createElement('div');
    var text = document.createElement('span');

    div2.setAttribute('class', 'item');
    text.innerHTML = 'section-' + (index + 1) + '
('+ item.x +', '+ item.y +', '+ item.width +', '+ item.height +')';

    div2.appendChild(text);
    div.appendChild(div2);
    createImage(item.dataURI, div2);
  });
}

function createImage(dataUrl, parent) {
  var img = new Image();
  parent = parent || document.body;

  img.src = dataUrl;
  parent.appendChild(img);
}<commit_msg>update example<commit_after>'use strict';

var imageToSlices = require('../lib/index');

var lineXArray = [60, 250];
var lineYArray = [100, 200];
var source = './images/building.png';

imageToSlices(source, lineXArray, lineYArray, {
  saveToDataUrl: true
}, function(dataUrlList) {
  console.log('sliced', dataUrlList);
  var result = document.getElementById('result');
  pushDataURI(300, 300, dataUrlList, result);
});

function pushDataURI(width, height, list, parent) {
  parent = parent || document.body;

  var div = document.createElement('div');
  div.style.width = width + 30 + 'px';
  div.style.height = height + 'px';
  div.setAttribute('class', 'imageWrapper');

  parent.appendChild(div);

  list.forEach(function(item, index) {
    var div2 = document.createElement('div');
    var text = document.createElement('span');

    div2.setAttribute('class', 'item');
    text.innerHTML = 'section-' + (index + 1) + '
('+ item.x +', '+ item.y +', '+ item.width +', '+ item.height +')';

    div2.appendChild(text);
    div.appendChild(div2);
    createImage(item.dataURI, div2);
  });
}

function createImage(dataUrl, parent) {
  var img = new Image();
  parent = parent || document.body;

  img.src = dataUrl;
  parent.appendChild(img);
}<|endoftext|>


<commit_before>const { Command } = require('discord.js-commando');
const moment = require('moment');
const { oneLine, stripIndents } = require('common-tags');

const Currency = require('../../structures/currency/Currency');
const Daily = require('../../structures/currency/Daily');

module.exports = class DailyRandomCommand extends Command {
	constructor(client) {
		super(client, {
			name: 'daily-random',
			group: 'economy',
			memberName: 'daily-random',
			description: `Gift your daily ${Currency.textPlural} to a random online user.`,
			guildOnly: true,
			throttling: {
				usages: 2,
				duration: 3
			}
		});
	}

	async run(msg) {
		const received = await Daily.received(msg.author.id);
		const guild = await msg.guild.fetchMembers();
		const member = guild.members.filter(mem => mem.presence.status === 'online' && !mem.user.bot).random();

		if (received) {
			const nextDaily = await Daily.nextDaily(msg.author.id);
			return msg.reply(stripIndents`
				you have already received your daily ${Currency.textPlural}.
				You can receive your next daily in ${moment.duration(nextDaily).format('hh [hours] mm [minutes]')}
			`);
		}

		if (member.id !== msg.author.id) {
			Daily.receive(msg.author.id, member.id);
			return msg.reply(oneLine`
				${member.displayName}#${member.user.discriminator} (${member.id}) has successfully received your daily
				${Currency.convert(Daily.dailyDonationPayout)}.
			`);
		}

		Daily.receive(msg.author.id);
		return msg.reply(`You have successfully received your daily ${Currency.convert(Daily.dailyPayout)}.`);
	}
};
<commit_msg>v1.0.3, daily random fixes, removed unneeded code<commit_after>const { Command } = require('discord.js-commando');
const moment = require('moment');
const { oneLine, stripIndents } = require('common-tags');

const Currency = require('../../structures/currency/Currency');
const Daily = require('../../structures/currency/Daily');

module.exports = class DailyRandomCommand extends Command {
	constructor(client) {
		super(client, {
			name: 'daily-random',
			group: 'economy',
			memberName: 'daily-random',
			description: `Gift your daily ${Currency.textPlural} to a random online user.`,
			guildOnly: true,
			throttling: {
				usages: 2,
				duration: 3
			}
		});
	}

	async run(msg) {
		const received = await Daily.received(msg.author.id);
		const guild = await msg.guild.fetchMembers();
		const member = guild.members.filter(mem => mem.presence.status === 'online' && !mem.user.bot).random();

		if (received) {
			const nextDaily = await Daily.nextDaily(msg.author.id);
			return msg.reply(stripIndents`
				you have already gifted your daily ${Currency.textPlural}.
				You can gift away your next daily in ${moment.duration(nextDaily).format('hh [hours] mm [minutes]')}
			`);
		}

		Daily.receive(msg.author.id, member.id);
		return msg.reply(oneLine`
			${member.displayName}#${member.user.discriminator} (${member.id}) has successfully received your daily
			${Currency.convert(Daily.dailyDonationPayout)}.
		`);
	}
};
<|endoftext|>


<commit_before>/**
 * nlform.js v1.0.0
 * http://www.codrops.com
 *
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Copyright 2013, Codrops
 * http://www.codrops.com
 */
;( function( window ) {

    'use strict';

    var document = window.document;

    if (!String.prototype.trim) {
        String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g, '');};
    }

    function NLForm( el ) {
        this.el = el;
        this.fields = [];
        this.fldOpen = -1;
        this._generateS('1');
        this._init();
    }

    NLForm.prototype = {
        _generateS: function(option) {
            var html = [
                'I want to ',
                '<select id="nl-form-1">',
                    '<option value="1">edit</option>',
                    '<option value="2">ask validation for</option>',
                    '<option value="3">share</option>',
                '</select>',
                ' this locality'
            ];
            if (option === '3' || option ==='2') {
                html.push(
                    ' via ',
                    '<select id="nl-form-2">',
                        '<option value="1">twitter</option>'
                    '</select>'
                );
            }

            this.el.innerHTML = html.join('');
            $('#nl-form-1').val(option);
            $APP.trigger('locality.show-info-adjust');
        },

        _init : function() {
            var self = this;
            Array.prototype.slice.call( this.el.querySelectorAll( 'select' ) ).forEach( function( el, i ) {
                self.fldOpen++;
                self.fields.push( new NLField( self, el, 'dropdown', self.fldOpen ) );
            } );
        },
        _closeFlds : function() {
            if( this.fldOpen !== -1 ) {
                this.fields[ this.fldOpen ].close();
            }
        },

        _check: function(elem) {
            if ($(elem).attr('id') == 'nl-form-1') {
                var val = $('#nl-form-1').val();
                this._generateS(val);
                this._init();
            }
        }
    };

    function NLField( form, el, type, idx ) {
        this.form = form;
        this.elOriginal = el;
        this.pos = idx;
        this.type = type;
        this._create();
        this._initEvents();
    }

    NLField.prototype = {
        _create : function() {
            if( this.type === 'dropdown' ) {
                this._createDropDown();
            }
        },
        _createDropDown : function() {
            var self = this;
            this.fld = document.createElement( 'div' );
            this.fld.className = 'nl-field nl-dd';
            this.toggle = document.createElement( 'a' );
            this.toggle.innerHTML = this.elOriginal.options[ this.elOriginal.selectedIndex ].innerHTML;
            this.toggle.className = 'nl-field-toggle';
            this.optionsList = document.createElement( 'ul' );
            var ihtml = '';
            Array.prototype.slice.call( this.elOriginal.querySelectorAll( 'option' ) ).forEach( function( el, i ) {
                ihtml += self.elOriginal.selectedIndex === i ? '
' + el.innerHTML + '
' : '
' + el.innerHTML + '
';
                // selected index value
                if( self.elOriginal.selectedIndex === i ) {
                    self.selectedIdx = i;
                }
            } );
            this.optionsList.innerHTML = ihtml;
            this.fld.appendChild( this.toggle );
            this.fld.appendChild( this.optionsList );
            this.elOriginal.parentNode.insertBefore( this.fld, this.elOriginal );
            this.elOriginal.style.display = 'none';
        },
        _initEvents : function() {
            var self = this;
            this.toggle.addEventListener( 'click', function( ev ) { ev.preventDefault(); ev.stopPropagation(); self._open(); } );
            this.toggle.addEventListener( 'touchstart', function( ev ) { ev.preventDefault(); ev.stopPropagation(); self._open(); } );

            if( this.type === 'dropdown' ) {
                var opts = Array.prototype.slice.call( this.optionsList.querySelectorAll( 'li' ) );
                opts.forEach( function( el, i ) {
                    el.addEventListener( 'click', function( ev ) { ev.preventDefault(); self.close( el, opts.indexOf( el ) ); } );
                    el.addEventListener( 'touchstart', function( ev ) { ev.preventDefault(); self.close( el, opts.indexOf( el ) ); } );
                } );
            }

        },
        _open : function() {
            if( this.open ) {
                return false;
            }
            this.open = true;
            this.form.fldOpen = this.pos;
            var self = this;
            this.fld.className += ' nl-field-open';
        },
        close : function( opt, idx ) {
            if( !this.open ) {
                return false;
            }
            this.open = false;
            this.form.fldOpen = -1;
            this.fld.className = this.fld.className.replace(/\b nl-field-open\b/,'');

            if( this.type === 'dropdown' ) {
                if( opt ) {
                    // remove class nl-dd-checked from previous option
                    var selectedopt = this.optionsList.children[ this.selectedIdx ];
                    selectedopt.className = '';
                    opt.className = 'nl-dd-checked';
                    this.toggle.innerHTML = opt.innerHTML;
                    // update selected index value
                    this.selectedIdx = idx;
                    // update original select element´s value
                    this.elOriginal.value = this.elOriginal.children[ this.selectedIdx ].value;
                    this.form._check(this.elOriginal);
                }
            }
        }
    };

    // add to global namespace
    window.NLForm = NLForm;

} )( window );
<commit_msg>removed "ask validation for"<commit_after>/**
 * nlform.js v1.0.0
 * http://www.codrops.com
 *
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Copyright 2013, Codrops
 * http://www.codrops.com
 */
;( function( window ) {

    'use strict';

    var document = window.document;

    if (!String.prototype.trim) {
        String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g, '');};
    }

    function NLForm( el ) {
        this.el = el;
        this.fields = [];
        this.fldOpen = -1;
        this._generateS('1');
        this._init();
    }

    NLForm.prototype = {
        _generateS: function(option) {
            var html = [
                'I want to ',
                '<select id="nl-form-1">',
                    '<option value="1">edit</option>',
                    '<option value="3">share</option>',
                '</select>',
                ' this locality'
            ];
            if (option === '3' || option ==='2') {
                html.push(
                    ' via ',
                    '<select id="nl-form-2">',
                        '<option value="1">twitter</option>'
                    '</select>'
                );
            }

            this.el.innerHTML = html.join('');
            $('#nl-form-1').val(option);
            $APP.trigger('locality.show-info-adjust');
        },

        _init : function() {
            var self = this;
            Array.prototype.slice.call( this.el.querySelectorAll( 'select' ) ).forEach( function( el, i ) {
                self.fldOpen++;
                self.fields.push( new NLField( self, el, 'dropdown', self.fldOpen ) );
            } );
        },
        _closeFlds : function() {
            if( this.fldOpen !== -1 ) {
                this.fields[ this.fldOpen ].close();
            }
        },

        _check: function(elem) {
            if ($(elem).attr('id') == 'nl-form-1') {
                var val = $('#nl-form-1').val();
                this._generateS(val);
                this._init();
            }
        }
    };

    function NLField( form, el, type, idx ) {
        this.form = form;
        this.elOriginal = el;
        this.pos = idx;
        this.type = type;
        this._create();
        this._initEvents();
    }

    NLField.prototype = {
        _create : function() {
            if( this.type === 'dropdown' ) {
                this._createDropDown();
            }
        },
        _createDropDown : function() {
            var self = this;
            this.fld = document.createElement( 'div' );
            this.fld.className = 'nl-field nl-dd';
            this.toggle = document.createElement( 'a' );
            this.toggle.innerHTML = this.elOriginal.options[ this.elOriginal.selectedIndex ].innerHTML;
            this.toggle.className = 'nl-field-toggle';
            this.optionsList = document.createElement( 'ul' );
            var ihtml = '';
            Array.prototype.slice.call( this.elOriginal.querySelectorAll( 'option' ) ).forEach( function( el, i ) {
                ihtml += self.elOriginal.selectedIndex === i ? '
' + el.innerHTML + '
' : '
' + el.innerHTML + '
';
                // selected index value
                if( self.elOriginal.selectedIndex === i ) {
                    self.selectedIdx = i;
                }
            } );
            this.optionsList.innerHTML = ihtml;
            this.fld.appendChild( this.toggle );
            this.fld.appendChild( this.optionsList );
            this.elOriginal.parentNode.insertBefore( this.fld, this.elOriginal );
            this.elOriginal.style.display = 'none';
        },
        _initEvents : function() {
            var self = this;
            this.toggle.addEventListener( 'click', function( ev ) { ev.preventDefault(); ev.stopPropagation(); self._open(); } );
            this.toggle.addEventListener( 'touchstart', function( ev ) { ev.preventDefault(); ev.stopPropagation(); self._open(); } );

            if( this.type === 'dropdown' ) {
                var opts = Array.prototype.slice.call( this.optionsList.querySelectorAll( 'li' ) );
                opts.forEach( function( el, i ) {
                    el.addEventListener( 'click', function( ev ) { ev.preventDefault(); self.close( el, opts.indexOf( el ) ); } );
                    el.addEventListener( 'touchstart', function( ev ) { ev.preventDefault(); self.close( el, opts.indexOf( el ) ); } );
                } );
            }

        },
        _open : function() {
            if( this.open ) {
                return false;
            }
            this.open = true;
            this.form.fldOpen = this.pos;
            var self = this;
            this.fld.className += ' nl-field-open';
        },
        close : function( opt, idx ) {
            if( !this.open ) {
                return false;
            }
            this.open = false;
            this.form.fldOpen = -1;
            this.fld.className = this.fld.className.replace(/\b nl-field-open\b/,'');

            if( this.type === 'dropdown' ) {
                if( opt ) {
                    // remove class nl-dd-checked from previous option
                    var selectedopt = this.optionsList.children[ this.selectedIdx ];
                    selectedopt.className = '';
                    opt.className = 'nl-dd-checked';
                    this.toggle.innerHTML = opt.innerHTML;
                    // update selected index value
                    this.selectedIdx = idx;
                    // update original select element´s value
                    this.elOriginal.value = this.elOriginal.children[ this.selectedIdx ].value;
                    this.form._check(this.elOriginal);
                }
            }
        }
    };

    // add to global namespace
    window.NLForm = NLForm;

} )( window );
<|endoftext|>


<commit_before>import React, { Component } from 'react';
import Formsy from 'formsy-react';
import classNames from 'classnames';
import ModalWrapper from './ModalWrapper';
import ModalTextField from './ModalTextField';
import AuthHOC from '../AuthHOC';

class ModalSignUp extends Component {
  componentDidUpdate(props, state, context) {
    const isOpen = this.context.modals.signUp.isOpen;
    const wasOpen = context.modals.signUp.isOpen;

    if (isOpen !== wasOpen && isOpen) {
      this.trackPageView();
    }
  };

  trackPageView() {
    analytics.page('Website', {
      Page: 'Sign Up'
    });
  };

  render() {
    const { auth, modals } = this.context;
    const { status, message, handlePasswordAuth, handleSocialAuth } = auth;
    const isFormInvalid = status !== 'done' && message;

    const inputClassName = classNames({
      'form__input': true,
      'is-invalid': isFormInvalid
    });

    const renderErrorMessage = (message = 'Oops! That email / password combination is not valid.') => (

{message}

    );

    return (
      <ModalWrapper modalName="signUp">

Sign up and start building

Build serverless apps on Syncano for free.
Set up your backend in minutes!

              <Formsy.Form onValidSubmit={(model) => handlePasswordAuth('register', model)}>
                <ModalTextField
                  className={inputClassName}
                  name="email"
                  validations="isEmail"
                  type="email"
                  placeholder="E-mail address"
                  autofocus
                  required
                />
                <ModalTextField
                  className={inputClassName}
                  type="password"
                  name="password"
                  placeholder="Password"
                  required
                />
                {isFormInvalid && renderErrorMessage(auth.message)}
                <button
                  className="button button--large button--featured"
                  disabled={status === 'processing' || status === 'done'}
                >
                  Start Building for Free
                </button>
              </Formsy.Form>

                or Sign up with

                   handleSocialAuth('google'), true}
                  >

                    Google

                   handleSocialAuth('github', true)}
                  >

                    GitHub

            Already have an account? Log in to your Dashboard.

      </ModalWrapper>
    );
  };
};

ModalSignUp.contextTypes = {
  auth: React.PropTypes.object,
  modals: React.PropTypes.object
};

export default AuthHOC(ModalSignUp);
<commit_msg>[WEB-429] Fix typo<commit_after>import React, { Component } from 'react';
import Formsy from 'formsy-react';
import classNames from 'classnames';
import ModalWrapper from './ModalWrapper';
import ModalTextField from './ModalTextField';
import AuthHOC from '../AuthHOC';

class ModalSignUp extends Component {
  componentDidUpdate(props, state, context) {
    const isOpen = this.context.modals.signUp.isOpen;
    const wasOpen = context.modals.signUp.isOpen;

    if (isOpen !== wasOpen && isOpen) {
      this.trackPageView();
    }
  };

  trackPageView() {
    analytics.page('Website', {
      Page: 'Sign Up'
    });
  };

  render() {
    const { auth, modals } = this.context;
    const { status, message, handlePasswordAuth, handleSocialAuth } = auth;
    const isFormInvalid = status !== 'done' && message;

    const inputClassName = classNames({
      'form__input': true,
      'is-invalid': isFormInvalid
    });

    const renderErrorMessage = (message = 'Oops! That email / password combination is not valid.') => (

{message}

    );

    return (
      <ModalWrapper modalName="signUp">

Sign up and start building

Build serverless apps on Syncano for free.
Set up your backend in minutes!

              <Formsy.Form onValidSubmit={(model) => handlePasswordAuth('register', model)}>
                <ModalTextField
                  className={inputClassName}
                  name="email"
                  validations="isEmail"
                  type="email"
                  placeholder="E-mail address"
                  autofocus
                  required
                />
                <ModalTextField
                  className={inputClassName}
                  type="password"
                  name="password"
                  placeholder="Password"
                  required
                />
                {isFormInvalid && renderErrorMessage(auth.message)}
                <button
                  className="button button--large button--featured"
                  disabled={status === 'processing' || status === 'done'}
                >
                  Start Building for Free
                </button>
              </Formsy.Form>

                or Sign up with

                   handleSocialAuth('google', true)}
                  >

                    Google

                   handleSocialAuth('github', true)}
                  >

                    GitHub

            Already have an account? Log in to your Dashboard.

      </ModalWrapper>
    );
  };
};

ModalSignUp.contextTypes = {
  auth: React.PropTypes.object,
  modals: React.PropTypes.object
};

export default AuthHOC(ModalSignUp);
<|endoftext|>


<commit_before>'use strict';

import React from 'react';
import { Image, Picker, StyleSheet, Text, View } from 'react-native';
import { CloudinaryImageNative } from 'react-cloudinary/lib/native';
import numeral from 'numeral';

import DefaultText from './DefaultText';
import OpenUrlButton from './OpenUrlButton';

export default React.createClass({
  render() {
    const { product, productVariant } = this.props;
    const image = productVariant.appImages.default[0];
    const { color, size } = productVariant.data;
    const KRW = productVariant.KRW || product.KRW;
    return (
      <View style={styles.container}>
        <OpenUrlButton url={`https://m.linkshops.com/products/${product.id}`}>
          <CloudinaryImageNative
            publicId={image.publicId}
            options={{ width: 200, height: 200 }}
            style={styles.thumbnail}
          />
        </OpenUrlButton>
        <View style={styles.descContainer}>
          <Text style={{ fontSize: 14, color: '#4c4c4c' }}>{color}</Text>
          <Text style={{ fontSize: 14, color: '#4c4c4c' }}>{size}</Text>
          <Text style={{ fontSize: 12, color: '#4c4c4c' }}>{`${numeral(KRW).format('0,0')}원`}</Text>
        </View>
      </View>
    );
  }
});

const styles = StyleSheet.create({
  container: {
    flexDirection: 'row',
    alignItems: 'center',
    height: 90,
    marginHorizontal: 12,
  },
  descContainer: {
    flex: 1,
  },
  thumbnail: {
    width: 60,
    height: 78,
    marginRight: 10,
    backgroundColor: '#F2F2F2',
    borderWidth: 1,
    borderColor: '#EAEAEA',
  },
});
<commit_msg>update product variant cell margin vertical.<commit_after>'use strict';

import React from 'react';
import { Image, Picker, StyleSheet, Text, View } from 'react-native';
import { CloudinaryImageNative } from 'react-cloudinary/lib/native';
import numeral from 'numeral';

import DefaultText from './DefaultText';
import OpenUrlButton from './OpenUrlButton';

export default React.createClass({
  render() {
    const { product, productVariant } = this.props;
    const image = productVariant.appImages.default[0];
    const { color, size } = productVariant.data;
    const KRW = productVariant.KRW || product.KRW;
    return (
      <View style={styles.container}>
        <OpenUrlButton url={`https://m.linkshops.com/products/${product.id}`}>
          <CloudinaryImageNative
            publicId={image.publicId}
            options={{ width: 200, height: 200 }}
            style={styles.thumbnail}
          />
        </OpenUrlButton>
        <View style={styles.descContainer}>
          <Text style={{ fontSize: 14, color: '#4c4c4c' }}>{color}</Text>
          <Text style={{ fontSize: 14, color: '#4c4c4c' }}>{size}</Text>
          <Text style={{ fontSize: 12, color: '#4c4c4c' }}>{`${numeral(KRW).format('0,0')}원`}</Text>
        </View>
      </View>
    );
  }
});

const styles = StyleSheet.create({
  container: {
    flexDirection: 'row',
    alignItems: 'center',
    marginHorizontal: 12,
    marginVertical: 15,
  },
  descContainer: {
    flex: 1,
  },
  thumbnail: {
    width: 60,
    height: 78,
    marginRight: 10,
    backgroundColor: '#F2F2F2',
    borderWidth: 1,
    borderColor: '#EAEAEA',
  },
});
<|endoftext|>


<commit_before>IFS.application.progressiveSelect = (function () {
  'use strict'
  var s
  var index = 0
  return {
    settings: {
      selectEl: 'select.prog-menu',
      dropdownContainer: '.assign-container .assign-button'
    },
    init: function () {
      s = this.settings
      IFS.application.progressiveSelect.initDomChanges()
      IFS.application.progressiveSelect.initEventHandlers()
    },
    initEventHandlers: function () {
      jQuery(document).on('click', function () {
        IFS.application.progressiveSelect.hideAll()
      })
      jQuery('body').on('click', '.assign-button [aria-controls]', function (e) {
        e.stopPropagation()
        IFS.application.progressiveSelect.toggleDropdown(this)
      })
    },
    initDomChanges: function () {
      jQuery(s.dropdownContainer).each(function () {
        IFS.application.progressiveSelect.initDropDownHTML(this)
      })
      jQuery(s.selectEl).each(function () {
        IFS.application.progressiveSelect.selectToListHTML(this)
      })
    },
    selectToListHTML: function (el) {
      el = jQuery(el)
      el.prev('label').remove()
      el.next('button').remove()
      var children = el.children('option')
      var name = el.attr('name')
      var html = '
'
      children.each(function () {
        var inst = jQuery(this)
        var content = inst.html()
        var value = inst.attr('value')

        if (inst.is('[disabled]')) {
          html += '
' + content + '
'
        } else {
          html += '
<button value="' + value + '" name="' + name + '" class="buttonlink">' + content + '</button>
'
        }
      })
      html += '
'
      el.after(html).remove()
      jQuery('body').trigger('updateSerializedFormState')
    },
    initDropDownHTML: function (el) {
      var inst = jQuery(el)
      var id = 'dropdown-' + index   // create unique id for a11y relationship
      // wrap the content and make it focusable
      inst.next().wrapAll('
')
      // Add the button inside the
 so both the heading and button semanics are read
      inst.wrapInner('<button aria-expanded="false" aria-controls="' + id + '" type="button">')
      index++
    },
    toggleDropdown: function (el) {
      var inst = jQuery(el)
      var dropdown = jQuery('#' + inst.attr('aria-controls'))
      var state = inst.attr('aria-expanded') === 'false'

      IFS.application.progressiveSelect.hideAll()
      if (state) {
        inst.attr('aria-expanded', 'true')
        dropdown.attr('aria-hidden', 'false')
      }
    },
    hideAll: function () {
      jQuery('[aria-controls*="dropdown-"][aria-expanded="true"]').attr('aria-expanded', 'false')
      jQuery('[id^="dropdown-"][aria-hidden="false"]').attr('aria-hidden', 'true')
    }

  }
})()
<commit_msg>IFS-3319 Add ids to assign team<commit_after>IFS.application.progressiveSelect = (function () {
  'use strict'
  var s
  var index = 0
  return {
    settings: {
      selectEl: 'select.prog-menu',
      dropdownContainer: '.assign-container .assign-button'
    },
    init: function () {
      s = this.settings
      IFS.application.progressiveSelect.initDomChanges()
      IFS.application.progressiveSelect.initEventHandlers()
    },
    initEventHandlers: function () {
      jQuery(document).on('click', function () {
        IFS.application.progressiveSelect.hideAll()
      })
      jQuery('body').on('click', '.assign-button [aria-controls]', function (e) {
        e.stopPropagation()
        IFS.application.progressiveSelect.toggleDropdown(this)
      })
    },
    initDomChanges: function () {
      jQuery(s.dropdownContainer).each(function () {
        IFS.application.progressiveSelect.initDropDownHTML(this)
      })
      jQuery(s.selectEl).each(function () {
        IFS.application.progressiveSelect.selectToListHTML(this)
      })
    },
    selectToListHTML: function (el) {
      el = jQuery(el)
      el.prev('label').remove()
      el.next('button').remove()
      var children = el.children('option')
      var name = el.attr('name')
      var html = '
'
      children.each(function () {
        var inst = jQuery(this)
        var content = inst.html()
        var value = inst.attr('value')

        if (inst.is('[disabled]')) {
          html += '
' + content + '
'
        } else {
          html += '
<button id="assign-' + value + '" value="' + value + '" name="' + name + '" class="buttonlink">' + content + '</button>
'
        }
      })
      html += '
'
      el.after(html).remove()
      jQuery('body').trigger('updateSerializedFormState')
    },
    initDropDownHTML: function (el) {
      var inst = jQuery(el)
      var id = 'dropdown-' + index   // create unique id for a11y relationship
      // wrap the content and make it focusable
      inst.next().wrapAll('
')
      // Add the button inside the
 so both the heading and button semanics are read
      inst.wrapInner('<button aria-expanded="false" aria-controls="' + id + '" type="button">')
      index++
    },
    toggleDropdown: function (el) {
      var inst = jQuery(el)
      var dropdown = jQuery('#' + inst.attr('aria-controls'))
      var state = inst.attr('aria-expanded') === 'false'

      IFS.application.progressiveSelect.hideAll()
      if (state) {
        inst.attr('aria-expanded', 'true')
        dropdown.attr('aria-hidden', 'false')
      }
    },
    hideAll: function () {
      jQuery('[aria-controls*="dropdown-"][aria-expanded="true"]').attr('aria-expanded', 'false')
      jQuery('[id^="dropdown-"][aria-hidden="false"]').attr('aria-hidden', 'true')
    }

  }
})()
<|endoftext|>