8000 "Nice hack, EssGeEich." · cpluspluscom/EnhancedCpp.com@0cd3fe5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0cd3fe5

Browse files
committed
0 parents  commit 0cd3fe5

File tree

7 files changed

+124
-0
lines changed

7 files changed

+124
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Huh?
2+
====
3+
This is the original version of the extension with the twicker-approved icon. It fell out of use when Chrome permanently disabled extensions that weren't from the Chrome Web Store. This version only includes the quote button, not the code-ize button.

css/style.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

icon/128.png

10.1 KB
Loading

icon/16.png

428 Bytes
Loading

icon/48.png

2.28 KB
Loading

js/code.js

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
do {
2+
3+
if(!document.getElementsByClassName('postreply').length)
4+
break;
5+
6+
var currenttopic = document.location.pathname;
7+
var occ = 0;
8+
var ctbegin = 0;
9+
var ctend = 0;
10+
for(var zix = 0; zix < currenttopic.length; zix++)
11+
{
12+
if(currenttopic[zix] == '/'
13+
|| currenttopic[zix] == '\\')
14+
{
15+
occ++;
16+
if(occ == 3)
17+
{
18+
ctbegin = zix+1;
19+
}
20+
else if(occ == 4)
21+
{
22+
ctend = zix;
23+
break;
24+
}
25+
}
26+
}
27+
if(ctbegin == 0 || ctend == 0)
28+
break;
29+
currenttopic = currenttopic.substring(ctbegin,ctend);
30+
currenttopic = parseInt(currenttopic);
31+
if(isNaN(currenttopic))
32+
break;
33+
34+
var x = document.getElementById('CH_PostList');
35+
if(!x)
36+
break;
37+
var y = x.getElementsByTagName('div');
38+
if(!y.length)
39+
break;
40+
41+
var spanlist;
42+
var postlist = [];
43+
var currItem;
44+
for(var zix = 0; currItem = y[zix]; zix++)
45+
{
46+
if((currItem.id.indexOf('msg') == 0) &&
47+
(!isNaN(parseInt(currItem.id.substr(3),10))))
48+
{
49+
spanlist = currItem.getElementsByTagName('span');
50+
for(var ziy = 0; ziy < spanlist.length; ziy++)
51+
{
52+
if((spanlist[ziy].className == 'dbtn') &&
53+
(spanlist[ziy].id.indexOf('CH_btn') == 0) &&
54+
(!isNaN(parseInt(spanlist[ziy].id.substr(6))))
55+
)
56+
{
57+
var postid = parseInt(spanlist[ziy].id.substr(6));
58+
if(isNaN(postid))
59+
continue;
60+
var newspancontent = '<span><a href="javascript:post';
61+
newspancontent += postid;
62+
newspancontent += '.quote()" class="C_btn narrow" title="Quote post"><b class="C_ico postreply"></b>Quote</a></span>';
63+
newspancontent += spanlist[ziy].innerHTML;
64+
spanlist[ziy].innerHTML = newspancontent;
65+
}
66+
}
67+
}
68+
}
69+
// http://www.cplusplus.com/forum/post.cgi?w=text&p= #ID
70+
// ---> Formatted text
71+
72+
//var fcode = "";
73+
74+
75+
var code = "for_Post.prototype.quote = function(){var result = '';var Network = new XMLHttpRequest();Network.onreadystatechange = function(){if(Network.readyState == 4 && Network.status == 200){result = Network.responseText;}else result = 'error';}; Network.open('GET','http://www.cplusplus.com/forum/post.cgi\?w=text\&p=' + this.postid,false);Network.send();\
76+
var reply = document.getElementById('CH_reply');\
77+
reply = reply.getElementsByTagName('a');\
78+
if(result != 'error')\
79+
{\
80+
if(reply[0].href.indexOf('javascript:thread') == 0)\
81+
{\
82+
eval(reply[0].href.substr(11)+';');\
83+
}\
84+
reply = document.getElementById('CH_reply');\
85+
reply = reply.getElementsByTagName('textarea');\
86+
var replier = this.el.innerHTML;\
87+
var begin = replier.indexOf('<b>');\
88+
var end = replier.indexOf('</b>');\
89+
if(begin > 0 && end > 0)\
90+
replier = '=' + replier.substring(begin+3,end);\
91+
else\
92+
replier = '';\
93+
reply[0].value += '[quote';\
94+
reply[0].value += replier;\
95+
reply[0].value += ']'+result+'[/quote]';\
96+
}}";
97+
var s = document.createElement('script');
98+
s.textContent = code;
99+
document.documentElement.appendChild(s);
100+
101+
} while(0);

manifest.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"content_scripts": [ {
3+
"css": [ "css/style.css" ],
4+
"js": [ "js/code.js" ],
5+
"matches": [ "http://www.cplusplus.com/*" ],
6+
"run_at": "document_end"
7+
} ],
8+
"description": "~ Made by SGH ~",
9+
"icons": {
10+
"128": "icon/128.png",
11+
"16": "icon/16.png",
12+
"48": "icon/48.png"
13+
},
14+
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnLUP8GJjqFTifViJXi8FExxBrvdTcucoM6u3pp9KwlqOtGuFSpJH9MWYTvjG7eUEp6oLBzDW4cjP1gyUQ2ELuRbfOpJLBizBw92bbQfXKtRMjVpjJ2GRhyebnzmChjfKdbIK4m7pPHQyQP9IRVEw4g/+UAUVpycZGBweyVLkTJwIDAQAB",
15+
"manifest_version": 2,
16+
"name": "CPlusPlus.com Quote Button",
17+
"permissions": [ "notifications", "tabs", "storage", "http://*/*" ],
18+
"version": "1.0"
19+
}

0 commit comments

Comments
 (0)
0