Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

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

Behavior

Save Automatically?

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

              
                <section id="app" class="section">
  <div class="container">
    <div class="columns is-centerd">
      <div class="column">
        <h1 class="title has-text-centered">Bookmarklet Maker</h1>
      </div>
    </div>

    
    <div class="columns">
      <div class="column">
        <form class="box">
          <div class="field is-grouped">
            <a class="button is-link"  v-bind:href="outputCode">{{ title }}</a>
          </div>
          <div class="notification">
            上のボタンをブックマークバーまでドラッグしてください。
          </div>
          <div class="field">
            <div class="field-label">
              <label class="label">Title</label>
            </div>
            <div class="control">
              <input class="input" type="text"  v-model="title" />
            </div>
          </div>
          <div class="field">
            <div class="field-label is-normal">
              <label class="label">Script</label>
            </div>
            <div class="control">
              <textarea id="input-text" class="textarea" v-model="inputCode" placeholder="Input your script here." autocomplete="off"></textarea>
            </div>
          </div>
          <div class="field">
             <div class="field-label is-normal">
              <label class="label">bookmark URL</label>
            </div>
           <div class="control is-expanded">
              <textarea id="out-text" v-bind:class="[textareaClass, resultClass]" v-model="encodedOutputCode" readonly placeholder="Input your code here"></textarea>
            </div>
          </div>
        </form>
      </div>
    </div>
  </div>
</section>
              
            
!

CSS

              
                h1.title {
  font-size: 1.5rem;
}

#app {
  min-height: 100vh;
  background: #10c1a2;
}

label.label {
  text-align: left;
}


              
            
!

JS

              
                const vue = new Vue({
  el: "#app",
  data: {
    title: '🔃Twitter',
    inputCode: `(() => {
  // もうタイマー呼び出しが定義済みならキャンセルして終了
  if (window.autoReloadId) {
    clearInterval(window.autoReloadId);
    delete window.autoReloadId;
    // 自動読み込み中であることを示す 🔃 をタイトルから削除
    document.title = document.title.replace("🔃", "");
    return;
  }

  // 後で参照するために一番上のツィートの id を保存
  let topItemIdSave = document.querySelector("li.stream-item").id;

  // 広告を隠す
  const hideAd = () =>
    Array.from(
      document.querySelectorAll("a.js-promoted-badge"),
      e =>
        (e.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.style.display =
          "none")
    );
  hideAd();

  window.autoReloadId = setInterval(() => {
    // 自動読み込み中であることを示すためタイトルに 🔃 を追加
    if (document.title.indexOf("🔃") < 0) {
      document.title = "🔃" + document.title;
    }
    // スクロール中ならばこれ以上何もしない
    if (document.scrollingElement.scrollTop !== 0) {
      return;
    }
    const topItemId = document.querySelector("li.stream-item").id;
    if (topItemIdSave === topItemIdSave) {
      // 「新しいツイートをn件を見る」が表示されていたらクリックする
      const e = document.querySelector(".new-tweets-bar");
      e && e.click();
    } else {
      topItemIdSave = topItemId;
      hideAd();
    }
  }, 500);
})();`,
    textareaClass: "textarea",
    isError: false,
    outputCode: "#",
    errorText: ""
  },
  computed: {
    resultClass() {
      return this.isError ? "is-danger" : "is-success";
    },
    encodedOutputCode() {
      return this.isError ? this.errorText : encodeURI(this.outputCode);
    }
  },
  watch: {
    inputCode: {
      immediate: true,
      handler: function() {
        const result = UglifyJS.minify(this.inputCode);
        if (result.error) {
          this.isError = true;
          this.errorText = result.error;
        } else {
          this.isError = false;
          this.outputCode = `javascript:${result.code}`;
        }
      }
    }
  },
  methods: {}
});

              
            
!
999px

Console