{"id":430,"date":"2011-12-21T12:01:16","date_gmt":"2011-12-21T03:01:16","guid":{"rendered":"http:\/\/www.whoocus.com\/blog\/wordpress\/?p=430"},"modified":"2011-12-21T12:01:16","modified_gmt":"2011-12-21T03:01:16","slug":"430","status":"publish","type":"post","link":"https:\/\/www.blowfish.co.jp\/?p=430","title":{"rendered":"jQuery Plugin \u4e8b\u59cb\u3081 \u305d\u306e2"},"content":{"rendered":"<p><a href=\"https:\/\/www.blowfish.co.jp\/wordpress\/?p=286\">\u4ee5\u524d\u306e\u8a18\u4e8b<\/a>\u3067\u3001jQuery\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u7c21\u5358\u306b\u4f5c\u6210\u3057\u3066\u307f\u305f\u304c\u3001\u307e\u3060\u307e\u3060\u878d\u901a\u304c\u5229\u304b\u306a\u3044\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u3044\u308d\u3093\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u89e3\u8aad\u3057\u3066\u307f\u3066\u3001\u305d\u3053\u305d\u3053\u4f7f\u3048\u308b\u5f62\u5f0f\u304c\u898b\u3048\u3066\u304d\u305f\u306e\u3067\u8a18\u8f09\u3059\u308b\u3002<br \/>\n\u3053\u306e\u8a18\u8ff0\u65b9\u6cd5\u3060\u3068\u3001\u5185\u90e8\u304b\u3089\u3082\u5916\u90e8\u304b\u3089\u3082\u95a2\u6570\u3092\u30b3\u30fc\u30eb\u3067\u304d\u308b\u306e\u3067\u3001\u5f8c\u306b\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6e21\u3059\u3053\u3068\u304c\u3067\u304d\u308b\u3002<\/p>\n<p>jquery.sample.js<br \/>\n[javascript]<br \/>\n\/*<br \/>\n * \u81ea\u4f5c\u30d7\u30e9\u30b0\u30a4\u30f3\u30b5\u30f3\u30d7\u30eb<br \/>\n *\/<br \/>\n;(function($){<br \/>\n\tvar sample = function(target, opts){<br \/>\n\t\t\/\/\u30c7\u30d5\u30a9\u30eb\u30c8\u30d1\u30e9\u30e1\u30fc\u30bf<br \/>\n\t\tthis.defaults = {<br \/>\n\t        param : &#8216;hoge&#8217;,<br \/>\n\t        params : [{title : &#8216;DefTitle1&#8217;, name: &#8216;DefName1&#8217;, id: &#8216;111&#8217; },<br \/>\n\t                  {title : &#8216;DefTitle2&#8217;, name: &#8216;DefName2&#8217;, id: &#8216;222&#8217; }<br \/>\n\t                 ],<br \/>\n\t        width :  &#8216;1200px&#8217;<br \/>\n\t\t}<br \/>\n\t\t\/\/\u30d1\u30e9\u30e1\u30fc\u30bf\u4e0a\u66f8\u304d<br \/>\n\t\t$.extend(this.defaults, opts || {});<\/p>\n<p>\t\t\/\/\u95a2\u6570\u30b3\u30fc\u30eb<br \/>\n\t\tthis.init();<br \/>\n\t\tthis.reload(this.defaults.width);<\/p>\n<p>\t}<br \/>\n\t\/\/\u95a2\u6570\u5b9a\u7fa9<br \/>\n\tsample.prototype = {<br \/>\n\t\tinit: function() {<br \/>\n\t\t\talert(&quot;Init:&quot; + this.defaults.param);<br \/>\n\t\t},<br \/>\n\t\treload: function(str) {<br \/>\n\t\t\talert(&quot;Reload:&quot; + str);<br \/>\n\t\t}<br \/>\n\t};<\/p>\n<p>\t\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\t\/\/ \u30a8\u30f3\u30c8\u30ea\u30dd\u30a4\u30f3\u30c8<br \/>\n\t\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n    $.fn.sample = function(options){<br \/>\n\t    \/\/\u30aa\u30d7\u30b7\u30e7\u30f3\u53d6\u5f97<br \/>\n\t    opts = jQuery.extend({}, $.fn.sample.defaults, options);<\/p>\n<p>\/\/\t    return this.each(function(){<br \/>\n\/\/\t\t\tnew sample(this, options, temp);<br \/>\n\/\/\t\t});<\/p>\n<p>\t\tif ( $(this).length &gt; 1) {<br \/>\n\t\t\tvar _instances = [];<br \/>\n\t\t\t$(this).each(function(i) {<br \/>\n\t\t\t\t_instances[i] = new sample(this, options);<br \/>\n\t\t\t});<br \/>\n\t\t\treturn _instances;<br \/>\n\t\t} else {<br \/>\n\t\t\treturn new sample(this, options);<br \/>\n\t\t}<br \/>\n    };<\/p>\n<p>\t\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n    \/\/\u30c7\u30d5\u30a9\u30eb\u30c8\u5024<br \/>\n\t\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br \/>\n\/\/    $.fn.sample.defaults = {<br \/>\n\/\/        param : &#8216;hoge&#8217;,<br \/>\n\/\/        params : [{title : &#8216;defTitle1&#8217;, name: &#8216;defName1&#8217;, id: &#8216;111&#8217; },<br \/>\n\/\/                  {title : &#8216;defTitle2&#8217;, name: &#8216;defName2&#8217;, id: &#8216;222&#8217; }<br \/>\n\/\/                 ],<br \/>\n\/\/        width :  &#8216;1200px&#8217;<br \/>\n\/\/    };<br \/>\n})(jQuery);<br \/>\n[\/javascript]<\/p>\n<p>\u30b3\u30fc\u30eb\u3059\u308b\u5074 [HTML]<br \/>\n[html]<br \/>\n&lt;script type=&quot;text\/javascript&quot;&gt;<br \/>\n$(&quot;#sample&quot;).sample({param:&#8217;moge&#8217;}).reload(&#8216;hage!!&#8217;);<br \/>\n&lt;\/script&gt;<br \/>\n&lt;div id=&quot;sample&quot;&gt;&lt;\/div&gt;<br \/>\n[\/html]<\/p>\n<p>\u4f46\u3057\u3001\u5341\u5206\u306a\u691c\u8a3c\u306f\u3057\u3066\u3044\u306a\u3044\u306e\u3067\u3001\u81ea\u5df1\u8cac\u4efb\u3067\u53c2\u8003\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u524d\u306e\u8a18\u4e8b\u3067\u3001jQuery\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u3092\u7c21\u5358\u306b\u4f5c\u6210\u3057\u3066\u307f\u305f\u304c\u3001\u307e\u3060\u307e\u3060\u878d\u901a\u304c\u5229\u304b\u306a\u3044\u3002 \u305d\u3053\u3067\u3001\u3044\u308d\u3093\u306a\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u89e3\u8aad\u3057\u3066\u307f\u3066\u3001\u305d\u3053\u305d\u3053\u4f7f\u3048\u308b\u5f62\u5f0f\u304c\u898b\u3048\u3066\u304d\u305f\u306e\u3067\u8a18\u8f09\u3059\u308b\u3002 \u3053\u306e\u8a18\u8ff0\u65b9\u6cd5\u3060\u3068\u3001\u5185\u90e8\u304b\u3089\u3082\u5916\u90e8\u304b\u3089\u3082\u95a2\u6570\u3092 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"saved_in_kubio":false,"footnotes":""},"categories":[10,4],"tags":[],"class_list":["post-430","post","type-post","status-publish","format-standard","hentry","category-javascript","category-tech"],"_links":{"self":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/430","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=430"}],"version-history":[{"count":0,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=\/wp\/v2\/posts\/430\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blowfish.co.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}