From a88a6159935fad3eeae3ddcaa0646513b5a3d9b7 Mon Sep 17 00:00:00 2001 From: anekos Date: Thu, 21 Jul 2011 22:47:48 +0900 Subject: スタイルの統一 --- google-plus-commando.js | 254 ++++++++++++++++++++++++------------------------ 1 file changed, 129 insertions(+), 125 deletions(-) diff --git a/google-plus-commando.js b/google-plus-commando.js index 7041f5a..a3745e1 100644 --- a/google-plus-commando.js +++ b/google-plus-commando.js @@ -35,7 +35,7 @@ THE POSSIBILITY OF SUCH DAMAGE. // INFO {{{ let INFO = <> - (snip)
"); + return sels.join('
(snip)
'); }, - getUploader: function () { return []; }, + getUploader: function () [], getMediaLink: function (isPhoto) { if (this.window && !isPhoto) return [null, this.window.location.href]; - var data = [null, this.imageURL]; + let data = [null, this.imageURL]; if (this.imageElement) data.push(this.imageElement.height, this.imageElement.width); @@ -1072,8 +1076,8 @@ let INFO = }, getMediaType: function (isPhoto) { if (isPhoto) { - var type = this.getMimeType(this.imageURL, "image/jpeg"); - var data = [null, this.imageURL, null, type, "photo", null,null,null,null,null,null,null]; + let type = this.getMimeType(this.imageURL, 'image/jpeg'); + let data = [null, this.imageURL, null, type, 'photo', null,null,null,null,null,null,null]; if (this.imageElement) data.push(this.imageElement.width, this.imageElement.height); else @@ -1083,26 +1087,26 @@ let INFO = } if (this.window && !isPhoto) { type = this.window.document.contentType; - switch (type.split("/")[0]) { - case "image": - return [null, this.window.location.href, null, type, "image"]; - case "text": + switch (type.split('/')[0]) { + case 'image': + return [null, this.window.location.href, null, type, 'image']; + case 'text': default: - return [null, this.window.location.href, null, "text/html", "document"]; + return [null, this.window.location.href, null, 'text/html', 'document']; } } else if (this.imageURL) { - type = this.getMimeType(this.imageURL, "image/jpeg"); - return [null, this.imageURL, null, type, "image"]; + type = this.getMimeType(this.imageURL, 'image/jpeg'); + return [null, this.imageURL, null, type, 'image']; } return null }, getMediaImage: function (isPhoto) { - var url; + let url; if (this.window && !isPhoto) { - let type = this.window.document.contentType.split("/"); - if (type[0] != "image") { + let type = this.window.document.contentType.split('/'); + if (type[0] != 'image') { let host = this.window.location.host; - url = "//s2.googleusercontent.com/s2/favicons?domain=" + host; + url = '//s2.googleusercontent.com/s2/favicons?domain=' + host; return [ [null, url, null, null], [null, url, null, null] ]; } else { url = this.window.location.href; @@ -1121,17 +1125,17 @@ let INFO = return [ data, data ]; }, getProvider: function (isPhoto) { - return [ [null, (isPhoto ? "images" : ""), "http://google.com/profiles/media/provider"] ]; + return [ [null, (isPhoto ? 'images' : ''), 'http://google.com/profiles/media/provider'] ]; } }; - var classes = {}, checker = {}; + let classes = {}, checker = {}; function MediaLink() { this.init.apply(this, arguments); }; MediaLink.prototype = commonProto; - var self = { + let self = { addType: function (name, checkFunc, proto) { checker[name] = checkFunc; - var func = function () { this.init.apply(this, arguments); }; + let func = function () { this.init.apply(this, arguments); }; proto.__super__ = proto.__proto__ = commonProto; func.prototype = proto; classes[name] = func; @@ -1146,42 +1150,42 @@ let INFO = } }; - (function() { + (function () { // ------------------------------------------------------------------------- // YouTube // ----------------------------------------------------------------------{{{ - self.addType("youtube", + self.addType('youtube', function (win) { if (!win) return false; return /^https?:\/\/(?:.*\.)?youtube.com\/watch/.test(win.location.href); }, { get VIDEO_ID () { - var id = this.window.wrappedJSObject.yt.config_.VIDEO_ID; - Object.defineProperty(this, "VIDEO_ID", { value: id }); + let id = this.window.wrappedJSObject.yt.config_.VIDEO_ID; + Object.defineProperty(this, 'VIDEO_ID', {value: id}); return id; }, - getMediaLink: function () [null, "http://www.youtube.com/v/" + this.VIDEO_ID + "&hl=en&fs=1&autoplay=1"], - getContentsText: function () this.window.document.querySelector("meta[name=description]").content, - getMediaType: function () [null, this.window.location.href, null, "application/x-shockwave-flash", "video"], + getMediaLink: function () [null, 'http://www.youtube.com/v/' + this.VIDEO_ID + '&hl=en&fs=1&autoplay=1'], + getContentsText: function () this.window.document.querySelector('meta[name=description]').content, + getMediaType: function () [null, this.window.location.href, null, 'application/x-shockwave-flash', 'video'], getMediaImage: function () { - var url = "https://ytimg.googleusercontent.com/vi/" + this.VIDEO_ID + "/hqdefault.jpg"; + let url = 'https://ytimg.googleusercontent.com/vi/' + this.VIDEO_ID + '/hqdefault.jpg'; return [ [null, url, 120, 160], [null, url, 120, 160] ]; }, - getProvider: function () [ [null, "youtube", "http://google.com/profiles/media/provider"] ], + getProvider: function () [ [null, 'youtube', 'http://google.com/profiles/media/provider'] ], }); // }}} // ------------------------------------------------------------------------- // Gyazo // ----------------------------------------------------------------------{{{ - self.addType("gyazo", + self.addType('gyazo', function (win, image) { - var reg = /^http:\/\/gyazo\.com\/\w+(\.png)?/; + let reg = /^http:\/\/gyazo\.com\/\w+(\.png)?/; return reg.test(image); }, { init: function (win, imageURL) { this.window = win; - if (imageURL.lastIndexOf(".png") != imageURL.length - 4) - imageURL += ".png"; + if (imageURL.lastIndexOf('.png') != imageURL.length - 4) + imageURL += '.png'; this.imageURL = imageURL; this.hasPhoto = true; -- cgit v1.2.3