個人用
by
amachang
2010-10-14 [2010/10/14 22:20:27]
個人用
@@ -1,54 +1,12 @@
/*
- * @title クリック数をグラフで見る
- * @description クリック数をグラフで見る
+ * @title 個人用
+ * @description 個人用
* @include http://*
* @license MIT License
* @require
*/
-var parentEl = document.getElementById('bookmarked_user');
-var nodes = parentEl.childNodes;
-
-var ElementInfo = function(el, count, username) {
- this.el = el;
- this.count = count;
- this.username = username;
-};
-
-var totalCount = 0;
-var elList = [];
-for (var i = 0, l = nodes.length; i < l; i++) {
- var el = nodes[i];
- if (el.nodeType === 1) {
- var usernameEl = Ten.DOM.getElementsByClassName('username', el)[0];
- var countEl = Ten.DOM.getElementsByClassName('click-count', el)[0];
- if (countEl) {
- var username = usernameEl.innerText || usernameEl.textContent;
- var count = countEl.innerText || countEl.textContent;
- var m = count.match(/\d+/);
- count = +m[0];
- elList.push(new ElementInfo(el, count, username));
- totalCount += count;
- }
- }
-}
-
-elList = elList.sort(function(a, b) { return b.count - a.count });
-
-var otherCount = 0;
-var labelList = [];
-var dataList = [];
-for (var i = 0; i < elList.length; i++) {
- if (elList[i].count / totalCount < 0.01) {
- otherCount += elList[i].count;
- }
- else {
- labelList.push(elList[i].username + ' (' + elList[i].count + ') ' + Math.floor(elList[i].count / totalCount * 1000) / 10 + '%');
- dataList.push(elList[i].count / totalCount);
- }
-}
-
-labelList.push('other ' + ' (' + otherCount + ') ' + Math.floor(otherCount / totalCount * 1000) / 10 + '%');
-dataList.push(otherCount / totalCount);
-
-location.href = 'http://chart.apis.google.com/chart?cht=p&chd=t:' + dataList.join(',') + '&chs=600x200&chl=' + labelList.join('|')
+var list = $$('li[userid] a[onclick]').filter(function(e) { return e.parentNode.className != 'disabled' });
+var i = 0;
+setInterval(function() { var e = document.createEvent('MouseEvent');
+e.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); list[i].dispatchEvent(e); i++ }, 10000);
/*
* @title 個人用
* @description 個人用
* @include http://*
* @license MIT License
* @require
*/
var list = $$('li[userid] a[onclick]').filter(function(e) { return e.parentNode.className != 'disabled' });
var i = 0;
setInterval(function() { var e = document.createEvent('MouseEvent');
e.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); list[i].dispatchEvent(e); i++ }, 10000);
- Permalink
- このページへの個別リンクです。
- RAW
- 書かれたコードへの直接のリンクです。
- Packed
- 文字列が圧縮された書かれたコードへのリンクです。
- Userscript
- Greasemonkey 等で利用する場合の .user.js へのリンクです。
- Loader
- @require やソースコードが長い場合に多段ロードする Loader コミのコードへのリンクです。
- Metadata
- コード中にコメントで @xxx と書かれたメタデータの JSON です。