From 829f6a22e800ef9c87a3160e300f96cf54e9f49e Mon Sep 17 00:00:00 2001
From: teramako
Date: Wed, 3 Apr 2013 21:04:52 +0900
Subject: fix: twittperator.js
---
twittperator.js | 150 +++++++++++++++++++++++++++-----------------------------
1 file changed, 73 insertions(+), 77 deletions(-)
(limited to 'twittperator.js')
diff --git a/twittperator.js b/twittperator.js
index 0da88e8..ef28958 100644
--- a/twittperator.js
+++ b/twittperator.js
@@ -24,8 +24,7 @@
*/
// INFO {{{
-let INFO =
-<>
+let INFO = xml`
@@ -333,7 +332,7 @@ let INFO =
プラグイン書きましょう。
->;
+`;
// }}}
@@ -1708,9 +1707,9 @@ let INFO =
let center = m[0];
let [head, tail] = [center[0], center.slice(1)];
let right = str.substring(m.index + m[0].length);
- let content = head === "@" ? {center}
- : {center} ;
- return <>{Utils.anchorLink(left)}{content}{Utils.anchorLink(right)}>;
+ let content = head === "@" ? ` ${center} `
+ : ` ${center} `;
+ return `${Utils.anchorLink(left)}${content}${Utils.anchorLink(right)}`;
}
return str;
}, // }}}
@@ -1783,7 +1782,7 @@ let INFO =
{},
function(json) {
function idToIcon (id) {
- return {icons[id] ?
: <>😸>};
+ return `${icons[id] ? `
` : "😸"}`;
}
let icons = {};
@@ -1791,14 +1790,14 @@ let INFO =
if (t.user && t.user.id_str && t.user.profile_image_url)
icons[t.user.id_str] = t.user.profile_image_url;
}
- liberator.echo(<>
+ liberator.echo(xml`
- - Retweeter {json.retweeters_count}
- - {template.map(json.retweeters, idToIcon)}
- - Favoriters {json.favoriters_count}
- - {template.map(json.favoriters, idToIcon)}
+ - Retweeter ${json.retweeters_count}
+ - ${template.map(json.retweeters, idToIcon)}
+ - Favoriters ${json.favoriters_count}
+ - ${template.map(json.favoriters, idToIcon)}
- >);
+ `);
}
);
}, // }}}
@@ -1874,36 +1873,35 @@ let INFO =
lookupUser: function(users) { // {{{
function showUsersInfo(json) { // {{{
let xml = modules.template.map(json, function(user) {
- return <>
+ return xml`
-
+
|
-
- {user.name}
+
+ ${user.name}
|
- {user.location} -
- id {user.id_str} -
- {user.following ? '' : 'not'} following -
- {user.friends_count}/{user.followers_count} ee/er -
- {user.statuses_count} tweets -
- {user.favourites_count} favs -
- {user.listed_count} listed -
- from {new Date(user.created_at).toLocaleString()}
+ ${user.location} -
+ id ${user.id_str} -
+ ${user.following ? '' : 'not'} following -
+ ${user.friends_count}/${user.followers_count} ee/er -
+ ${user.statuses_count} tweets -
+ ${user.favourites_count} favs -
+ ${user.listed_count} listed -
+ from ${new Date(user.created_at).toLocaleString()}
|
- {user.description}
+ ${user.description}
|
- >;
+ `;
});
- liberator.echo(
- <>
+ liberator.echo(xml`
-
- >
- );
+
+ `);
} // }}}
let ids = [], screenNames = [];
@@ -1994,59 +1991,56 @@ let INFO =
function menuEvent(st)
("window.parent.liberator.modules.plugins.twittperator.Twittperator.showStatusMenu(" + parseInt(st.id) + ")");
- let html = .toSource()
- .replace(/(?:\r\n|[\r\n])[ \t]*/g, " ") +
+ ]]>`
+ .replace(/(?:\r\n|[\r\n])[ \t]*/g, " ") +
+ '' +
s.reduce(function(table, status) {
- return table.appendChild(
- ("retweeted_status" in status) ?
- let (rt = status.retweeted_status)
-
+ if ("retweeted_status" in status) {
+ let rt = status.retweeted_status;
+ return table + xml`
-
-
- {rt.user.screen_name}
+
+
+ ${rt.user.screen_name}
-
-
+
+
|
- {Utils.anchorLink(rt.text)}
+ ${Utils.anchorLink(rt.text)}
|
-
:
-
+
`.toString();
+ } else {
+ return table + xml`
-
-
- {status.user.screen_name}
+
+
+ ${status.user.screen_name}
|
- {Utils.anchorLink(status.text)}
+ ${Utils.anchorLink(status.text)}
|
-
- );
-
- }, )
- .toSource().replace(/(?:\r\n|[\r\n])[ \t]*/g, " ");
+ `.toString();
+ }
+ }, "").replace(/(?:\r\n|[\r\n])[ \t]*/g, " ") +
+ '
';
- liberator.echo(html, true);
+ window.Services.console.logStringMessage(html);
+ liberator.echo(new TemplateXML(html), true);
}, // }}}
showTwitterMentions: function(arg) { // {{{
tw.jsonGet("statuses/mentions", null, function(res) {
@@ -2173,25 +2167,25 @@ let INFO =
context.compare = void 0;
context.createRow = function(item, highlightGroup) {
if (highlightGroup === "CompTitle") {
- return
-
{item}
- ;
+ return xml`
+
${item}
+ `;
}
let [value, st] = item.item;
if (st.user) {
- return
+ return xml`
-
- {st.user.screen_name}: {st.text}
+
+ ${st.user.screen_name}: ${st.text}
-
;
+
`;
} else {
- return
+ return xml`
- {st.text}
+ ${st.text}
- ;
+
`;
}
};
@@ -2361,20 +2355,22 @@ let INFO =
description: "Display status information",
action: function(arg) {
function dtdd(obj) {
- let items = <>>;
+ let items = "";
for (let [n, v] in Iterator(obj)) {
let cont = (v && typeof v === "object") ? dtdd(v) : v;
- items += <>{n}{cont}>;
+ items += `${n}${cont}`;
}
- return {items}
;
+ return `${items}
`;
}
let m = arg.match(/^\d+/);
if (!m)
return;
let id = m[0];
- history.filter(function(st) st.id === id).map(dtdd).forEach(liberator.echo);
+ history.filter(function(st) st.id === id).map(dtdd).forEach(function(v) {
+ liberator.echo(new TemplateXML(v));
+ });
},
timelineCompleter: true,
completer: Completers.rawid(function(st) st.id)
--
cgit v1.2.3