| author | ymh <ymh.work@gmail.com> |
| Fri, 18 Oct 2024 10:24:57 +0200 | |
| changeset 1074 | 231ea5ea7de4 |
| parent 1072 | ac1eacb3aa33 |
| permissions | -rw-r--r-- |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
1 |
import _ from "lodash"; |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
2 |
import tweetStyles from "./Tweet.module.css"; |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
3 |
import jQuery from "jquery"; |
| 880 | 4 |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
5 |
const Tweet = function (ns) { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
6 |
return class extends ns.Widgets.Widget { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
7 |
constructor(player, config) { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
8 |
super(player, config); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
9 |
this.lastAnnotation = false; |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
10 |
} |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
11 |
|
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
12 |
static defaults = { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
13 |
hide_timeout: 10000, |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
14 |
polemics: [ |
| 880 | 15 |
{ |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
16 |
keywords: ["++"], |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
17 |
color: "#30d765", |
| 880 | 18 |
}, |
19 |
{ |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
20 |
keywords: ["--"], |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
21 |
color: "#f51123", |
| 880 | 22 |
}, |
23 |
{ |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
24 |
keywords: ["=="], |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
25 |
color: "#f1e24a", |
| 880 | 26 |
}, |
27 |
{ |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
28 |
keywords: ["??"], |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
29 |
color: "#05aae6", |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
30 |
}, |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
31 |
], |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
32 |
annotation_type: "tweet", |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
33 |
pin_at_start: false, |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
34 |
}; |
| 880 | 35 |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
36 |
static messages = { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
37 |
fr: { |
| 880 | 38 |
retweet: "Retweeter", |
39 |
reply: "Répondre", |
|
| 982 | 40 |
keep_visible: "Empêcher la fermeture automatique", |
| 880 | 41 |
dont_keep_visible: "Permettre la fermeture automatique", |
42 |
close_widget: "Fermer l'affichage du tweet", |
|
| 1002 | 43 |
original_time: "Heure d'envoi\u00a0: ", |
44 |
video_time: "Temps de la vidéo\u00a0: ", |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
45 |
show_original: "Voir l'original", |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
46 |
}, |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
47 |
en: { |
| 880 | 48 |
retweet: "Retweet", |
49 |
reply: "Reply", |
|
50 |
keep_visible: "Keep visible", |
|
51 |
dont_keep_visible: "Don't keep visible", |
|
52 |
close_widget: "Close tweet display", |
|
53 |
original_time: "Tweet sent at: ", |
|
| 918 | 54 |
video_time: "Video time: ", |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
55 |
show_original: "Show original", |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
56 |
}, |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
57 |
}; |
| 880 | 58 |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
59 |
static template = |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
60 |
'<div class="Ldt-Tweet-Widget"><div class="Ldt-Tweet-Inner"><div class="Ldt-Tweet-PinClose-Buttons">' + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
61 |
'<a href="#" class="Ldt-Tweet-Pin Ldt-TraceMe{{#pin_at_start}} active" title="{{l10n.dont_keep_visible}}{{/pin_at_start}}{{^pin_at_start}}" title="{{l10n.keep_visible}}{{/pin_at_start}}"></a>' + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
62 |
'<a href="#" class="Ldt-Tweet-Close Ldt-TraceMe" title="{{l10n.close_widget}}"></a>' + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
63 |
'</div><div class="Ldt-Tweet-AvatarContainer"><a href="#" class="Ldt-Tweet-ProfileLink" target="_blank">' + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
64 |
'<img src="" class="Ldt-Tweet-Avatar"/></a></div><h3><a href="#" class="Ldt-Tweet-ProfileLink Ldt-Tweet-ScreenName" target="_blank">' + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
65 |
'</a> (<span class="Ldt-Tweet-FullName"></span>)</h3><p class="Ldt-Tweet-Contents"></p><div class="Ldt-Tweet-Bottom">' + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
66 |
'<span class="Ldt-Tweet-Time"></span>' + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
67 |
'<a class="Ldt-Tweet-Original" href="" target="_blank">{{l10n.show_original}}</a>' + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
68 |
'<a href="" target="_blank" class="Ldt-Tweet-Retweet"><div class="Ldt-Tweet-Icon"></div>{{l10n.retweet}}</a>' + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
69 |
'<a href="" target="_blank" class="Ldt-Tweet-Reply"><div class="Ldt-Tweet-Icon"></div>{{l10n.reply}}</a></div></div></div>'; |
| 880 | 70 |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
71 |
draw() { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
72 |
this.renderTemplate(); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
73 |
this.pinned = this.pin_at_start; |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
74 |
var _this = this; |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
75 |
this.$.find(".Ldt-Tweet-Pin").click(function () { |
| 880 | 76 |
_this.pinned = !_this.pinned; |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
77 |
var _el = jQuery(this); |
| 880 | 78 |
if (_this.pinned) { |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
79 |
_el.addClass("active").attr("title", _this.l10n.dont_keep_visible); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
80 |
_this.cancelTimeout(); |
| 880 | 81 |
} else { |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
82 |
_el.removeClass("active").attr("title", _this.l10n.keep_visible); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
83 |
_this.hideTimeout(); |
| 880 | 84 |
} |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
85 |
}); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
86 |
this.$.find(".Ldt-Tweet-Close").click(function () { |
| 880 | 87 |
_this.hide(); |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
88 |
}); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
89 |
this.$.hide(); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
90 |
this.getWidgetAnnotations().forEach(function (_annotation) { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
91 |
_annotation.on("click", function () { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
92 |
_this.show(_annotation); |
| 964 | 93 |
}); |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
94 |
}); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
95 |
} |
| 880 | 96 |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
97 |
show(_tweet) { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
98 |
if ( |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
99 |
typeof _tweet !== "undefined" && |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
100 |
typeof _tweet.source !== "undefined" |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
101 |
) { |
|
988
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
987
diff
changeset
|
102 |
var extend = [ |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
103 |
[ |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
104 |
/#(\w+)/gm, |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
105 |
function (matches) { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
106 |
return ( |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
107 |
'<a href="http://twitter.com/search?q=%23' + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
108 |
matches[1] + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
109 |
'" target="_blank">' |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
110 |
); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
111 |
}, |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
112 |
"</a>", |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
113 |
], |
|
988
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
987
diff
changeset
|
114 |
]; |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
115 |
var _urls = _(_tweet.source.entities.urls).sortBy(function (_entity) { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
116 |
return _entity.indices[0]; |
| 880 | 117 |
}); |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
118 |
|
| 880 | 119 |
var _currentPos = 0, |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
120 |
_txt = ""; |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
121 |
_(_urls).each(function (_url) { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
122 |
if (_url.indices[0] >= _currentPos) { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
123 |
_txt += _tweet.source.text.substring(_currentPos, _url.indices[0]); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
124 |
_txt += |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
125 |
typeof _url.expanded_url !== "undefined" && |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
126 |
_url.expanded_url !== null |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
127 |
? _url.expanded_url |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
128 |
: _url.url; |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
129 |
_currentPos = _url.indices[1]; |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
130 |
} |
|
988
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
987
diff
changeset
|
131 |
}); |
|
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
987
diff
changeset
|
132 |
_txt += _tweet.source.text.substring(_currentPos); |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
133 |
|
|
988
eefd336335f9
Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents:
987
diff
changeset
|
134 |
for (var _i = 0; _i < this.polemics.length; _i++) { |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
135 |
var rx = ns.Model.regexpFromTextOrArray(this.polemics[_i].keywords); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
136 |
extend.push([ |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
137 |
rx, |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
138 |
'<span style="background: ' + this.polemics[_i].color + '">', |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
139 |
"</span>", |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
140 |
]); |
| 880 | 141 |
} |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
142 |
var rx = _tweet.found |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
143 |
? _this.source.getAnnotations().regexp || false |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
144 |
: false, |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
145 |
profile_url = _tweet.source.user |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
146 |
? _tweet.source.user.profile_image_url |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
147 |
: _tweet.source.profile_image_url, |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
148 |
screen_name = _tweet.source.user |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
149 |
? _tweet.source.user.screen_name |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
150 |
: _tweet.source.from_user, |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
151 |
user_name = _tweet.source.user |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
152 |
? _tweet.source.user.name |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
153 |
: _tweet.source.from_user_name; |
| 989 | 154 |
this.$.find(".Ldt-Tweet-Avatar").attr("src", profile_url); |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
155 |
this.$.find(".Ldt-Tweet-ScreenName").html("@" + screen_name); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
156 |
this.$.find(".Ldt-Tweet-ProfileLink").attr( |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
157 |
"href", |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
158 |
"https://twitter.com/" + screen_name |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
159 |
); |
| 989 | 160 |
this.$.find(".Ldt-Tweet-FullName").html(user_name); |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
161 |
this.$.find(".Ldt-Tweet-Contents").html( |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
162 |
ns.textFieldHtml(_txt, rx, extend) |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
163 |
); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
164 |
this.$.find(".Ldt-Tweet-Time").html( |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
165 |
this.l10n.original_time + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
166 |
new Date(_tweet.source.created_at).toLocaleTimeString() + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
167 |
" / " + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
168 |
this.l10n.video_time + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
169 |
_tweet.begin.toString() |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
170 |
); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
171 |
this.$.find(".Ldt-Tweet-Retweet").attr( |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
172 |
"href", |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
173 |
"https://twitter.com/intent/retweet?tweet_id=" + _tweet.source.id_str |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
174 |
); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
175 |
this.$.find(".Ldt-Tweet-Reply").attr( |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
176 |
"href", |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
177 |
"https://twitter.com/intent/tweet?in_reply_to=" + _tweet.source.id_str |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
178 |
); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
179 |
this.$.find(".Ldt-Tweet-Original").attr( |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
180 |
"href", |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
181 |
"https://twitter.com/" + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
182 |
screen_name + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
183 |
"/status/" + |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
184 |
_tweet.source.id_str |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
185 |
); |
| 957 | 186 |
this.player.trigger("Annotation.minimize"); |
| 880 | 187 |
this.$.slideDown(); |
188 |
this.cancelTimeout(); |
|
189 |
if (!this.pinned) { |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
190 |
this.hideTimeout(); |
| 880 | 191 |
} |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
192 |
} else { |
| 880 | 193 |
this.hide(); |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
194 |
} |
| 880 | 195 |
} |
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
196 |
|
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
197 |
hide() { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
198 |
this.player.trigger("Annotation.maximize"); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
199 |
this.$.slideUp(); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
200 |
this.cancelTimeout(); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
201 |
} |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
202 |
|
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
203 |
cancelTimeout() { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
204 |
if (typeof this.hide_timer !== "undefined") { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
205 |
window.clearTimeout(this.hide_timer); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
206 |
this.hide_timer = undefined; |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
207 |
} |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
208 |
} |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
209 |
|
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
210 |
hideTimeout() { |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
211 |
this.cancelTimeout(); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
212 |
this.hide_timer = window.setTimeout( |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
213 |
this.functionWrapper("hide"), |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
214 |
this.hide_timeout |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
215 |
); |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
216 |
} |
|
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
217 |
}; |
| 1013 | 218 |
}; |
| 880 | 219 |
|
|
1072
ac1eacb3aa33
Migrate source and build to vite.js
ymh <ymh.work@gmail.com>
parents:
1013
diff
changeset
|
220 |
export { Tweet, tweetStyles }; |