<commit_before><link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/paper-card/paper-card.html">
<link rel="import" href="../bower_components/paper-item/paper-item.html">

<dom-module id="cz-clock-dash">

  <template>
    <style>
      paper-card {
        display: block;
      }
      paper-card .card-flex {
        display: flex;
        align-content: center;
      }
      paper-item {
        box-sizing: border-box;
        width: 80%;
      }
      div {
        font-size: 22pt;
      }
      .localTime {
        font-size: 60pt;
      }
      .workingHours {
        color: green;
      }
      .notWorkingHours {
        color: red;
      }
    </style>

    <paper-card id='card' heading='&#127758; Time'>
      <div class="card-content">
        <div class='card-flex'>
          <template is='dom-repeat' items='{{timezones}}' filter="isLocal">
            <paper-item-body two-line>
              <div class="localTime">
                <span class$='{{item.data.class}}'>{{item.data.timeString}}</span>
              </div>
              <div id='city' secondary>{{item.city}}</div>
            </paper-item-body>
          </template>
        </div>
      </div>
      <div class="card-content">
        <div class='card-flex'>
          <template is='dom-repeat' items='{{timezones}}' filter="isNotLocal">
            <paper-item-body two-line>
              <div>
                <span class$='{{item.data.class}}'>{{item.data.timeString}}</span>
              </div>
              <div id='city' secondary>{{item.city}}</div>
            </paper-item-body>
          </template>
        </div>
      </div>
    </paper-card>
  </template>

  <script src="../bower_components/moment/moment.js"></script>
  <script src="../bower_components/moment-timezone/builds/moment-timezone-with-data.js"></script>

  <script>
    Polymer({
      is: 'cz-clock-dash',

      properties: {
        timezones: {
          type: 'Object',
          notify: true,
          value: function() { return []; }
        }
      },
      attached: function() {
        registerSource('cz-config', 'timezones', timezones => this.set('timezones', timezones));
        this.mutateTimeString();
      },
      currentTimeDay: function(timezone) {
        var d = moment(new Date()).tz(timezone.timezone);
        var data = {timeString: d.format("HH:mm"), class: this.workingHours(d)};
        console.log(data.timeString, data.class);
        return data;
      },
      mutateTimeString: function() {
        this.timezones.forEach((timezone, idx) => this.set('timezones.' + idx + '.data', this.currentTimeDay(timezone)));
        this.async(() => this.mutateTimeString(), 1000);
      },
      workingHours: function(d) {
        if (d.hour() < 9 || d.hour() >= 17) // 9am->5pm
          return "notWorkingHours";
        else if (d.day() == 0 || d.day() == 6) // 0==Sunday, 6==Saturday
          return "notWorkingHours";
        else
          return "workingHours";
      },
      isLocal: function(item) {
        return item.local;
      },
      isNotLocal: function(item) {
        return !(item.local);
      }
    });
  </script>
</dom-module><commit_msg>Add small timezone offset to clock.<commit_after><link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/paper-card/paper-card.html">
<link rel="import" href="../bower_components/paper-item/paper-item.html">

<dom-module id="cz-clock-dash">

  <template>
    <style>
      paper-card {
        display: block;
      }
      paper-card .card-flex {
        display: flex;
        align-content: center;
      }
      paper-item {
        box-sizing: border-box;
        width: 80%;
      }
      div {
        font-size: 22pt;
      }
      .localTime {
        font-size: 60pt;
      }
      .workingHours {
        color: green;
      }
      .notWorkingHours {
        color: red;
      }
    </style>

    <paper-card id='card' heading='&#127758; Time'>
      <div class="card-content">
        <div class='card-flex'>
          <template is='dom-repeat' items='{{timezones}}' filter="isLocal">
            <paper-item-body two-line>
              <div class="localTime">
                <span class$='{{item.data.class}}'>{{item.data.timeString}}</span>
              </div>
              <div id='city' secondary>{{item.city}} <small id='offset'>({{item.data.offset}})</small></div>
            </paper-item-body>
          </template>
        </div>
      </div>
      <div class="card-content">
        <div class='card-flex'>
          <template is='dom-repeat' items='{{timezones}}' filter="isNotLocal">
            <paper-item-body two-line>
              <div>
                <span class$='{{item.data.class}}'>{{item.data.timeString}}</span>
              </div>
              <div id='city' secondary>{{item.city}} <small id='offset'>({{item.data.offset}})</small></div>
            </paper-item-body>
          </template>
        </div>
      </div>
    </paper-card>
  </template>

  <script src="../bower_components/moment/moment.js"></script>
  <script src="../bower_components/moment-timezone/builds/moment-timezone-with-data.js"></script>

  <script>
    Polymer({
      is: 'cz-clock-dash',

      properties: {
        timezones: {
          type: 'Object',
          notify: true,
          value: function() { return []; }
        }
      },
      attached: function() {
        registerSource('cz-config', 'timezones', timezones => this.set('timezones', timezones));
        this.mutateTimeString();
      },
      currentTimeDay: function(timezone) {
        var d = moment(new Date()).tz(timezone.timezone);
        var data = {timeString: d.format("HH:mm"), class: this.workingHours(d), offset: d.format("Z")};
        console.log(data.timeString, data.class);
        return data;
      },
      mutateTimeString: function() {
        this.timezones.forEach((timezone, idx) => this.set('timezones.' + idx + '.data', this.currentTimeDay(timezone)));
        this.async(() => this.mutateTimeString(), 1000);
      },
      workingHours: function(d) {
        if (d.hour() < 9 || d.hour() >= 17) // 9am->5pm
          return "notWorkingHours";
        else if (d.day() == 0 || d.day() == 6) // 0==Sunday, 6==Saturday
          return "notWorkingHours";
        else
          return "workingHours";
      },
      isLocal: function(item) {
        return item.local;
      },
      isNotLocal: function(item) {
        return !(item.local);
      }
    });
  </script>
</dom-module>
{'fraction_non_alphanumeric': 0.17610444815545773, 'fraction_numerical': 0.007590708972218006, 'mean_word_length': 2.0054744525547443, 'pattern_counts': {'":': 0, '<': 99, '<?xml version=': 0, '>': 107, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '781279', 'n_tokens_mistral': 2120, 'n_tokens_neox': 2035, 'n_words': 358}