<commit_before><link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/core-ajax/core-ajax.html">

<polymer-element name="my-element" noscript attributes="color owner">
  <template>
    <div style="{{ {color:'red', background: '#efefef'} | styleObject }}">
        <span>I'm <b>my-element</b>. This is my Shadow DOM. And its for {{owner}}.</span>
        <core-ajax url="/json.html" auto response="{{resp}}"></core-ajax>
        <textarea value="{{resp}}" style="display:block"></textarea>
        <div id="thePerson" style="color: {{color}}">Waiting...</div>
        <button on-click="{{setFocus}}">Set focus on owner</button>
        <button on-click="{{cloneThis}}">Clone this</button>
        <button on-click="{{deleteThis}}" id="deleteButton">{{deleteText}}</button>
        <input id="nameInput" value="{{owner | toUpperCase}}"
               placeholder="Enter name...">
    </div>
  </template>
  <script>
    Polymer({
        owner: "Someone",
        color: "red",
        typed: true,
        deleteText: "Delete This",
        ready: function () {
            this.$.thePerson.textContent = this.owner + " thinks this is cool."
        },
        attached: function () {
            this.hideOrShowDelete();
        },
        detached: function () {
            this.hideOrShowDelete();
        },
        hideOrShowDelete: function () {
            var display = (this.numMyElements() > 1) ? "inline-block" : "none";
            var elms = document.getElementsByTagName('my-element');
            for (var ii = 0; ii < elms.length; ii++) {
                elms[ii].$.deleteButton.style.display = display;
            }
        },
        ownerChanged:  function () {
            if (this.typed) {
                this.color = "blue";
            } else {
                this.color = "black";
            }
            this.typed = !this.typed;
        },
        setFocus: function () {
            this.$.nameInput.focus();
        },
        cloneThis: function () {
            var el = document.createElement('my-element');
            document.body.appendChild(el);
        },
        deleteThis: function () {
            this.remove();
        },
        numMyElements: function () {
            return document.getElementsByTagName('my-element').length;
        },
        toUpperCase: {
            toDOM: function (val) {
                return val.toUpperCase();
            },
            toModel: function (val) {
                return val.toUpperCase();
            }
        },
    });
  </script>
</polymer-element><commit_msg>add global filter<commit_after><link rel="import" href="../bower_components/polymer/polymer.html">
<link rel="import" href="../bower_components/core-ajax/core-ajax.html">

<polymer-element name="my-element" noscript attributes="color owner">
  <template>
    <div style="{{ {color:'red', background: '#efefef'} | styleObject }}">
        <span>I'm <b>my-element</b>. This is my Shadow DOM. And its for {{owner | plusOne}}.</span>
        <core-ajax url="/json.html" auto response="{{resp}}"></core-ajax>
        <textarea value="{{resp}}" style="display:block"></textarea>
        <div id="thePerson" style="color: {{color}}">Waiting...</div>
        <button on-click="{{setFocus}}">Set focus on owner</button>
        <button on-click="{{cloneThis}}">Clone this</button>
        <button on-click="{{deleteThis}}" id="deleteButton">{{deleteText}}</button>
        <input id="nameInput" value="{{owner | toUpperCase }}"
               placeholder="Enter name...">
    </div>
  </template>
  <script>
    Polymer({
        owner: "Someone",
        color: "red",
        typed: true,
        deleteText: "Delete This",
        ready: function () {
            this.$.thePerson.textContent = this.owner + " thinks this is cool."
        },
        attached: function () {
            this.hideOrShowDelete();
        },
        detached: function () {
            this.hideOrShowDelete();
        },
        hideOrShowDelete: function () {
            var display = (this.numMyElements() > 1) ? "inline-block" : "none";
            var elms = document.getElementsByTagName('my-element');
            for (var ii = 0; ii < elms.length; ii++) {
                elms[ii].$.deleteButton.style.display = display;
            }
        },
        ownerChanged:  function () {
            if (this.typed) {
                this.color = "blue";
            } else {
                this.color = "black";
            }
            this.typed = !this.typed;
        },
        setFocus: function () {
            this.$.nameInput.focus();
        },
        cloneThis: function () {
            var el = document.createElement('my-element');
            document.body.appendChild(el);
        },
        deleteThis: function () {
            this.remove();
        },
        numMyElements: function () {
            return document.getElementsByTagName('my-element').length;
        },
        toUpperCase: {
            toDOM: function (val) {
                return val.toUpperCase();
            },
            toModel: function (val) {
                return val.toUpperCase();
            }
        },
    });

    PolymerExpressions.prototype.plusOne = function (val) {
        return val + " one ";
    };

  </script>
</polymer-element>
{'fraction_non_alphanumeric': 0.16280373831775702, 'fraction_numerical': 0.0007476635514018691, 'mean_word_length': 1.9176663031624863, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, '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': '3601394', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1476, 'n_words': 296}