Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- TODO:
  *add Shortcut buttons menu
  *add YAH button
  *add Search functionality
  *add On-screen keyboard for search
-->
<!-- IN PROGRESS:
  *POI info view
-->
<div class="appContainer" ng-app="wfApp" ng-cloak>
  <div class="contentContainer" md-theme="{{theme}}" md-theme-watch="true" ng-controller="wfCtrl">
    <md-toolbar class="md-secondary md-config">
      <md-button class="md-primary md-raised" md-theme="{{t}}" ng-repeat="t in themes" ng-click="setTheme(t)">{{t}}</md-button>
    </md-toolbar>
    <md-toolbar class="md-primary">
      <md-input-container class="lang-menu" ng-controller="langCtrl">
        <md-select ng-model="currentLanguage">
          <md-option ng-repeat="lang in languages track by $index" ng-click="setLanguage(lang.name)" value="{{lang.name}}">
            {{lang.getName() | wfCurrentLanguage}}
          </md-option>
        </md-select>
      </md-input-container>
      <div class="logo" style="background-image: url({{buildingLogo}})"></div>
      <wf-material-floors-buttons group-class="btnGroup floors-buttons" button-class="btn floor md-fab md-mini" active-class="md-primary"></wf-floors-buttons>
    </md-toolbar>
    <md-content class="mapContainer md-hue-2">
      <div class="mapTab">
        <canvas id="map" resize cb-resize="cbResize()"></canvas>
      </div>
    </md-content>
    <md-side-nav class="sideMenu">
      <md-content>
        <md-tabs class="tab-heads md-primary" md-stretch-tabs="always">
          <md-tab>
            <md-tab-label>
              {{topics}}
            </md-tab-label>
            <md-tab-body>
              <md-content>
                <md-list class="topics mCustomScrollbar" ng-controller="topicsCtrl">
                  <md-list-item class="topic" ng-repeat="item in groups">
                    <div class="head" ng-click="item.showPois = !item.showPois">
                      <h4 class="name">
                      {{item.getNames() | wfCurrentLanguage}}
                      </h4>
                      <i class="icon fa" ng-class="(item.showPois ? 'fa-chevron-left':'fa-chevron-down')"></i>
                    </div>
                    <md-list class="pois" ng-show="item.showPois">
                      <md-list-item class="poi" ng-repeat="poi in item.pois">
                        <div class="name" ng-click="$parent.showInfo($event, poi)">
                          {{poi.getNames() | wfCurrentLanguage}}
                        </div>
                        <md-button class="md-fab md-mini" ng-click="$parent.showInfo($event, poi)">
                          <i class="md-fab icon fa fa-info"></i>
                        </md-button>
                        <md-button class="md-fab md-mini" ng-click="showPath(poi)">
                          <i class="md-fab icon fa fa-map-marker"></i>
                        </md-button>
                      </md-list-item>
                    </md-list>
                    <md-divider ng-if="!$last"></md-divider>
                  </md-list-item>
                </md-list>
              </md-content>
            </md-tab-body>
          </md-tab>
          <md-tab>
            <md-tab-label>
              {{atoz}}
            </md-tab-label>
            <md-tab-body>
              <md-content>
                <md-list class="atoz pois" ng-controller="atozCtrl">
                  <md-list-item class="poi" ng-repeat="poi in pois">
                    <div class="name" ng-click="$parent.showInfo($event, poi)">
                      {{poi.getNames() | wfCurrentLanguage}}
                    </div>
                    <md-button class="md-fab md-mini" ng-click="$parent.showInfo($event, poi)">
                      <i class="md-fab icon fa fa-info"></i>
                    </md-button>
                    <md-button class="md-fab md-mini" ng-click="showPath(poi)">
                      <i class="md-fab icon fa fa-map-marker"></i>
                    </md-button>
                    <md-divider ng-if="!$last"></md-divider>
                  </md-list-item>
                </md-list>
              </md-content>
            </md-tab-body>
          </md-tab>
        </md-tabs>
      </md-content>
    </md-side-nav>
  </div>

  <script type="text/ng-template" id="poiInfoModal.tmpl.html">
    <md-dialog class="poi-info" aria-label="Poi Info">
      <form ng-cloak>
        <md-toolbar>
          <div class="md-toolbar-tools">
            <h2>{{poi.names | wfCurrentLanguage}}</h2>
            <span flex></span>
            <md-button class="md-fab md-mini" ng-click="showPath(poi); cancel()">
              <i class="icon fa fa-map-marker"></i>
            </md-button>
            <md-button class="md-icon-button" ng-click="cancel()">
              <i class="icon fa fa-times"></i>
            </md-button>
          </div>
        </md-toolbar>
        <md-dialog-content class="background" style="background-image: url({{poi.backgroundURL}})">
          <md-content>
            <div class="description">
              <span ng-bind-html="poi.descriptions | wfCurrentLanguage"></span>
            </div>
            <div class="image" style="background-image: url({{poi.imageURL}})"></div>
          </md-content>
        </md-dialog-content>
      </form>
    </md-dialog>
  </script>
</div>
              
            
!

CSS

              
                @header-height: 64px;
@sidebar-width: 30%;
@list-button-size: 1.5em;

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.appContainer,
.contentContainer {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  > md-toolbar.md-secondary {
    position: absolute;
    width: 100%;
    height: @header-height;
    display: flex;
    flex-direction: row;
    overflow-x: scroll;
    overflow-y: hidden;
    .md-button {
      flex-grow: 1;
    }
  }
  > md-toolbar.md-primary {
    position: absolute;
    width: 100%-@sidebar-width;
    height: @header-height;
    top: @header-height;
    left: 0;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding: 0 1em;
    > * {
      width: auto;
      height: auto;
    }
    .logo {
      display: flex;
      height: @header-height * 0.75;
      width: @header-height * 2;
      background-size: contain;
      background-position: center;
      background-repeat: no-repeat;
    }
  }
  > md-content {
    position: absolute;
    top: @header-height*2;
    bottom: 0;
    width: 100%-@sidebar-width;
    overflow: hidden;
  }
  > md-side-nav {
    position: absolute;
    right: 0;
    top: @header-height;
    height: calc(~"100% - "@header-height);
    width: @sidebar-width;
    overflow: hidden;
    > md-content {
      overflow: hidden;
    }
  }
}

.mapContainer {
  position: relative;
  height: auto;
  width: 70%;
  .mapTab {
    position: relative;
    height: 100%;
    width: 100%;
    #map {
      width: 100%;
      height: 100%;
      background-color: teal;
      position: relative;
    }
  }
}

.sideMenu {
  background-color: #55555a;
  width: 30%;
  height: 100%;
  position: relative;
  display: flex;
  > md-content {
    width: 100%;
    height: 100%;
    md-tabs {
      height: 100%;
      width: 100%;
      md-tabs-wrapper {
        height: @header-height;
        md-tabs-canvas,
        md-pagination-wrapper {
          height: 100%;
          .md-tab {
            display: flex;
            align-items: center;
            justify-content: center;
          }
        }
      }
      md-tabs-content-wrapper {
        top: @header-height;
      }
    }
  }
}

.topics {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  .topic {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    flex: 1;
    width: 100%;
    > .head {
      width: 100%;
      display: inline-flex;
      flex-direction: row;
      justify-content: space-between;
      align-items: center;
      &:focus {
        outline: none;
      }
      > .name {
        width: 90%;
        &:focus {
          outline: none;
        }
      }
      > .icon {
        width: 10%;
      }
    }
    .pois {
      display: flex;
      flex-direction: column;
      justify-content: flex-start;
      width: 100%;
      .poi {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        .name {
          width: 90%;
          &:focus {
            outline: none;
          }
        }
        .md-fab {
          width: @list-button-size;
          height: @list-button-size;
          line-height: @list-button-size;
          min-height: @list-button-size;
          min-width: @list-button-size;
          padding: 0;
        }
      }
    }
  }
}

.atoz.pois {
  .poi {
    .name {
      width: 90%;
      &:focus {
        outline: none;
      }
    }
    .md-fab {
      width: @list-button-size;
      height: @list-button-size;
      line-height: @list-button-size;
      min-height: @list-button-size;
      min-width: @list-button-size;
      padding: 0;
    }
  }
}

.btn.floor {
  font-size: 1.25em;
  &.active {
    color: green;
  }
}

.lang-menu {
  text-transform: uppercase;
  min-width: 6em;
  margin: 0.5em;
  md-select-value {
    border-bottom-color: rgba(255, 255, 255, 0.12);
  }
  .md-select-icon {
    color: rgba(255, 255, 255, 0.12);
  }
}

md-option {
  text-transform: uppercase;
}

* {
  -webkit-user-select: none; /* Chrome/Safari */
  -moz-user-select: none; /* Firefox */
  -ms-user-select: none; /* IE10+ */

  /* Rules below not implemented in browsers yet */
  -o-user-select: none;
  user-select: none;
}

.md-dialog-container {
  position: absolute;
  height: 100% !important;
  width: 100% !important;
  .poi-info {
    position: absolute;
    min-width: 50%;
    width: auto;
    max-width: 75%;
    min-height: 50%;
    height: auto;
    max-height: 75%;
    overflow: hidden;
    form {
      position: absolute;
      width: 100%;
      height: 100%;
      display: block;
    }
    md-toolbar {
      height: @header-height;
    }
    md-dialog-content {
      position: relative;
      height: calc(~"100% - "@header-height);
      width: 100%;
      display: block;
      overflow: hidden;
      md-content {
        position: absolute;
        display: block;
        height: 100%;
        width: 100%;
        overflow: hidden;
        .description {
          padding: 0.75em;
          width: 50%;
          height: 90%;
          overflow: hidden;
          span {
            width: 100%;
            text-align: justify;
            display: block;
          }
        }
        .image {
          width: 50%;
          height: 90%;
          position: absolute;
          top: .75em;
          right: .5em;
          background-size: contain;
          background-repeat: no-repeat;
          background-position: center;
        }
      }
    }
  }
}

              
            
!

JS

              
                $(window).on("load", function() {
  $(".topics").mCustomScrollbar({
    theme: "dark",
    alwaysShowScrollbar: 1
  });
  $(".pois").mCustomScrollbar();
});

var wfApp = angular.module("wfApp", [
  "wfangular",
  "ngMaterial",
  "ngMessages",
  "ngSanitize"
]);

wfApp.config(function($mdThemingProvider) {
  $mdThemingProvider
    .theme("default")
    .dark()
    .primaryPalette("green")
    .accentPalette("yellow");
  $mdThemingProvider
    .theme("red")
    .primaryPalette("red")
    .accentPalette("blue");

  var lightRedMap = $mdThemingProvider.extendPalette("red", {
    '500': '#ff6666',
      'contrastDefaultColor': 'light'
    });
  $mdThemingProvider.definePalette("light-red", lightRedMap);
  $mdThemingProvider
    .theme("light-red")
    .primaryPalette("light-red")
    .accentPalette("light-blue");

  var darkRedMap = $mdThemingProvider.extendPalette("red", {
    '50': '#ff0000',
    '100': '#ee0000',
    '200': '#dd0000',
    '300': '#cc0000',
    '400': '#bb0000',
    '500': '#aa0000',
    '600': '#990000',
    '700': '#880000',
    '800': '#770000',
    '900': '#660000',
    'A100': '#ff2222',
    'A200': '#dd2222',
    'A400': '#aa2222',
    'A700': '#992222',
    'contrast': {
      '50': '#ffffff',
      '100': '#ffffff',
      '200': '#ffffff',
      '300': '#ffffff',
      '400': '#ffffff',
      '500': '#ffffff',
      '600': '#ffffff',
      '700': '#ffffff',
      '800': '#ffffff',
      '900': '#ffffff',
      'A100': '#ffffff',
      'A200': '#ffffff',
      'A400': '#ffffff',
      'A700': '#ffffff' 
    }
    });
  $mdThemingProvider.definePalette("dark-red", darkRedMap);
  $mdThemingProvider
    .theme("dark-red")
    .primaryPalette("dark-red")
    .accentPalette("dark-blue");

  var darkBlueMap = $mdThemingProvider.extendPalette("blue", {
    '50': '#0000ff',
    '100': '#0000ee',
    '200': '#0000dd',
    '300': '#0000cc',
    '400': '#0000bb',
    '500': '#0000aa',
    '600': '#000099',
    '700': '#000088',
    '800': '#000077',
    '900': '#000066',
    'A700': '#2222ff',
    'A400': '#4444ff',
    'A200': '#8888ff',
    'A100': '#ccccff',
    'light': '#ffffff',
    'contrastDefaultColor': 'white',
    'contrastLightColors': ['50', '100', '200', '300', '400', '500', '600', '700', '800', '900', 'A100', 'A200', 'A400', 'A700'],
    'contrastDarkColors': []
    });
  $mdThemingProvider.definePalette("dark-blue", darkBlueMap);
  $mdThemingProvider
    .theme("dark-blue")
    .primaryPalette("dark-blue")
    .accentPalette("dark-red");
  $mdThemingProvider
    .theme("pink")
    .primaryPalette("pink")
    .accentPalette("deep-purple");
  $mdThemingProvider
    .theme("purple")
    .primaryPalette("purple")
    .accentPalette("pink");
  $mdThemingProvider
    .theme("deep-purple")
    .primaryPalette("deep-purple")
    .accentPalette("deep-orange");
  $mdThemingProvider
    .theme("indigo")
    .primaryPalette("indigo")
    .accentPalette("pink");
  $mdThemingProvider
    .theme("blue")
    .primaryPalette("blue")
    .accentPalette("red");
  $mdThemingProvider
    .theme("light-blue")
    .primaryPalette("light-blue")
    .accentPalette("deep-purple");
  $mdThemingProvider
    .theme("cyan")
    .primaryPalette("cyan")
    .accentPalette("amber");
  $mdThemingProvider
    .theme("teal")
    .primaryPalette("teal")
    .accentPalette("cyan");
  $mdThemingProvider
    .theme("green")
    .primaryPalette("green")
    .accentPalette("orange");
  $mdThemingProvider
    .theme("light-green")
    .primaryPalette("light-green")
    .accentPalette("yellow");
  $mdThemingProvider
    .theme("lime")
    .primaryPalette("lime")
    .accentPalette("pink");
  $mdThemingProvider
    .theme("yellow")
    .primaryPalette("yellow")
    .accentPalette("light-blue");
  $mdThemingProvider
    .theme("amber")
    .primaryPalette("amber")
    .accentPalette("blue");
  $mdThemingProvider
    .theme("orange")
    .primaryPalette("orange")
    .accentPalette("indigo");
  $mdThemingProvider
    .theme("deep-orange")
    .primaryPalette("deep-orange")
    .accentPalette("deep-purple");
  $mdThemingProvider
    .theme("brown")
    .primaryPalette("brown")
    .accentPalette("red");
  $mdThemingProvider
    .theme("grey")
    .primaryPalette("grey")
    .accentPalette("blue-grey");
  $mdThemingProvider
    .theme("blue-grey")
    .primaryPalette("blue-grey")
    .accentPalette("blue-grey");

  $mdThemingProvider.alwaysWatchTheme(true);
});

wfApp.run([
  "$rootScope",
  "wfangular",
  function($rootScope, wayfinder) {
    WayfinderAPI.Location = "//api.3dwayfinder.com/";
    wayfinder.options.asstesLocation = "//static.3dwayfinder.com/shared/";
    wayfinder.open();
    $rootScope.wayfinder = wayfinder;
  }
]);

wfApp.controller("wfCtrl", [
  "$sce",
  "$scope",
  "$timeout",
  "$mdDialog",
  "wfangular",
  function($sce, $scope, $timeout, $mdDialog, wayfinder) {
    // scope variables
    var self = $scope;

    self.themes = [
      "default",
      "light-red",
      "red",
      "dark-red",
      "pink",
      "purple",
      "deep-purple",
      "indigo",
      "dark-blue",
      "blue",
      "light-blue",
      "cyan",
      "teal",
      "green",
      "light-green",
      "lime",
      "yellow",
      "amber",
      "orange",
      "deep-orange",
      "brown",
      "grey",
      "blue-grey"
    ];
    self.isDark = true;
    self.theme = "default-dark";
    self.setTheme = function(theme) {
      self.theme = theme;
    };
    self.topics = "Topics";
    self.atoz = "A-Z";
    self.floors = [];

    $scope.showInfo = function(evt, poi) {
      $mdDialog
        .show({
          controller: PoiInfoController,
          templateUrl: "poiInfoModal.tmpl.html",
          parent: angular.element(document.body),
          targetEvent: evt,
          clickOutsideToClose: true,
          fullscreen: $scope.customFullscreen,
          locals: {
            poi: poi,
            wayfinder: wayfinder
          }
        })
        .then(
          function(answer) {
            console.log("confirmed:", answer);
          },
          function() {
            console.log("cancelled");
          }
        );
    };

    function PoiInfoController($scope, $mdDialog, wayfinder, poi) {
      $scope.poi = poi;
      console.log("PoiInfoController::poi", poi);

      $scope.showPath = function(poi) {
        wayfinder.showPath(poi.getNode());
      };
      if ($scope.poi.image_id)
        $scope.poi.imageURL = WayfinderAPI.getURL(
          "images",
          "get",
          poi.image_id
        );
      else $scope.poi.imageURL = false;
      if ($scope.poi.background_id)
        $scope.poi.backgroundURL = WayfinderAPI.getURL(
          "images",
          "get",
          poi.background_id
        );
      else $scope.poi.backgroundURL = false;
      $scope.hide = function() {
        $mdDialog.hide();
      };

      $scope.cancel = function() {
        $mdDialog.cancel();
      };

      $scope.answer = function(answer) {
        $mdDialog.hide(answer);
      };
    }
    // scope functions
    self.cbResize = function() {
      wayfinder.resize();
    };

    self.setFloor = function(floor) {
      wayfinder.showFloor(floor);
    };

    self.showPath = function(poi) {
      console.log("poi:", poi);
      wayfinder.showPath(poi.getNode());
    };

    self.getGUITranslation = function(key, params) {
      //console.log("translation:", wayfinder.translator.get(key));
      if (!params) return wayfinder.translator.get(key);
      return wayfinder.translator.get(key, params);
    };

    self.$on("wf.language.change", function(lang) {
      $timeout(function() {
        self.topics = wayfinder.translator.get("topics");
        self.atoz = wayfinder.translator.get("az");
        self.$apply();
      });
    });

    // scope watchers
    self.$on("wf.map.ready", function() {
      angular.forEach(wayfinder.building.getFloors(), function(floor) {
        floor.active = false;
        self.floors.push(floor);
      });
      $scope.buildingLogo =
        "https:" +
        WayfinderAPI.getURL("images", "get", wayfinder.building.logoID);
      $timeout(function() {
        wayfinder.resize();
        self.$apply();
      }, 10);
    });

    self.$on("wf.floor.change", function(event, floor) {
      $timeout(function() {
        self.$apply(function() {
          angular.forEach(self.floors, function(item) {
            item.active = item.id == floor.id;
          });
        });
      }, 10);
    });
  }
]);

wfApp.controller("langCtrl", [
  "$scope",
  "$timeout",
  "wfangular",
  function($scope, $timeout, wayfinder) {
    $scope.currentLanguage = wayfinder.getLanguage();
    $scope.setLanguage = function(lang) {
      wayfinder.setLanguage(lang);
    };
    $scope.$on("wf.map.ready", function() {
      $scope.languages = wayfinder.getLanguages();
    });
  }
]);

wfApp.controller("topicsCtrl", [
  "$scope",
  "wfangular",
  function($scope, wayfinder) {
    var boolify = function(val) {
      //console.log(val + ':' + typeof val);
      switch (typeof val) {
        case "undefined":
        case "object":
        case "array":
          return false;
          break;
        case "boolean":
          return val;
          break;
        case "string":
          if (val.toLowerCase().match(/1|true|yes/g)) return true;
          else if (val.toLowerCase().match(/0|false|no/g)) return false;
          else return false;
          break;
        case "number":
          if ((Math.round(val) || val) > 0) return true;
          else return false;
          break;
        case "default":
          break;
      }
    };

    var extractGroups = function() {
      var arr = [];
      angular.forEach(wayfinder.getPOIGroups(), function(group) {
        if (group && boolify(group.showInMenu)) arr.push(group);
      });
      return arr;
    };

    $scope.getLanguage = function() {
      return wayfinder.getLanguage();
    };

    $scope.$on("wf.language.change", function(event, language) {
      $scope.currentLanguage = language;
    });
    $scope.$on("wf.map.ready", function() {
      //console.log("Loading groups");
      $scope.groups = extractGroups();
    });
  }
]);

wfApp.controller("atozCtrl", [
  "$scope",
  "wfangular",
  function($scope, wayfinder) {
    var boolify = function(val) {
      //console.log(val + ':' + typeof val);
      switch (typeof val) {
        case "undefined":
        case "object":
        case "array":
          return false;
          break;
        case "boolean":
          return val;
          break;
        case "string":
          if (val.toLowerCase().match(/1|true|yes/g)) return true;
          else if (val.toLowerCase().match(/0|false|no/g)) return false;
          else return false;
          break;
        case "number":
          if (Math.round(val) || val > 0) return true;
          else return false;
          break;
        case "default":
          break;
      }
    };
    var extractPOIs = function() {
      var arr = [];
      angular.forEach(wayfinder.getPOIs(), function(poi) {
        //console.log(poi);
        if (poi && boolify(poi.showInMenu)) arr.push(poi);
      });
      return arr;
    };

    $scope.getLanguage = function() {
      return wayfinder.getLanguage();
    };

    $scope.$on("wf.language.change", function(event, language) {
      $scope.currentLanguage = language;
    });
    $scope.$on("wf.map.ready", function() {
      //console.log("Loading POIs");
      $scope.pois = extractPOIs();
    });
  }
]);

wfApp.directive("wfMaterialFloorsButtons", [
  "wfangular",
  function(wayfinder) {
    return {
      restrict: "AE",
      template:
        '<md-button class="{{buttonClass}}"' +
        " ng-class=\"{'{{activeClass}}': floor.getActive()}\"" +
        ' ng-repeat="floor in data.floors"' +
        ' ng-click="onFakeClick(floor)">{{floor.getNames() | wfCurrentLanguage}}</md-button>',
      scope: {
        onFakeClick: "&",
        onClick: "&?",
        buttonClass: "@",
        activeClass: "@"
      },
      controller: function($scope) {
        $scope.data = {
          floors: []
        };

        $scope.$on("wf.data.loaded", function(event, data) {
          $scope.data.floors = wayfinder.building.getSortedFloors();
          //console.log("wayfinder.building.getSortedFloors();", wayfinder.building.getSortedFloors())
        });

        $scope.onFakeClick = function(sa) {
          if (typeof $scope.onClick === "function") {
            $scope.onClick({
              floor: sa
            });
          } else {
            console.log("else", sa);
            wayfinder.showFloor(sa);
          }
        };
      }
    };
  }
]);

              
            
!
999px

Console