Sha256: c580db795b1ec69e4d58c9b5e495e4c376bd215e9dc0744ff04565c22ac448f4

Contents?: true

Size: 1.03 KB

Versions: 52

Compression:

Stored size: 1.03 KB

Contents

# -*- coding: utf-8 -*-
# Copyright (C) 2011, KADO Masanori <kdmsnr@gmail.com>
# You can redistribute it and/or modify it under GPL.

# needs category.rb plugin

add_edit_proc do
  <<-HTML
<div class="make-link">

Link URL: <input type="text" id="make-link-url" style="width:400px" />
<button id="make-link-button">Get Title and Link</button>

<script>
$('#make-link-button').click(function() {
  var url = $('#make-link-url')[0].value;
  var title = $.ajax({
    url: "http://query.yahooapis.com/v1/public/yql",
    type: "GET",
    dataType: "json",
    async: false,
    data: {
      q: 'select * from html where url = "' + url + '" and xpath = "//head/title"',
      format: 'xml',
      charset: 'utf-8'
    }
  }).responseXML.getElementsByTagName('title')[0].textContent
    .replace(/\\n/g, ''); // FIXME: need to convert to UTF-8

  var link = "[[" + title + "|" + url + "]]";

  if (typeof(inj_c) == 'function') {
    inj_c(link); // old category.rb
  } else {
    $('#body').insertAtCaret(link);
  }

  return false;
});
</script>

</div>
HTML
end

Version data entries

52 entries across 46 versions & 2 rubygems

Version Path
tdiary-contrib-5.3.0 plugin/make_link.rb
tdiary-contrib-5.2.4 plugin/make_link.rb
tdiary-contrib-5.2.3 plugin/make_link.rb
tdiary-contrib-5.2.2 plugin/make_link.rb
tdiary-contrib-5.2.1 plugin/make_link.rb
tdiary-contrib-5.2.0 plugin/make_link.rb
tdiary-contrib-5.1.7 plugin/make_link.rb
tdiary-contrib-5.1.6 plugin/make_link.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-contrib-5.1.4/plugin/make_link.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/bundler/gems/tdiary-contrib-d1e41204db13/plugin/make_link.rb
tdiary-contrib-5.1.5 plugin/make_link.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-contrib-5.1.4/plugin/make_link.rb
tdiary-contrib-5.1.4 plugin/make_link.rb
tdiary-contrib-5.1.3 plugin/make_link.rb
tdiary-contrib-5.1.2 plugin/make_link.rb
tdiary-contrib-5.1.1 plugin/make_link.rb
tdiary-contrib-5.1.0 plugin/make_link.rb
tdiary-contrib-5.0.13 plugin/make_link.rb
tdiary-contrib-5.0.12 plugin/make_link.rb
tdiary-contrib-5.0.11 plugin/make_link.rb