Skip to content

Commit f62f043

Browse files
committed
change the host
1 parent 0c05579 commit f62f043

31 files changed

+28
-21
lines changed

chrome extension/linker_old.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,21 @@
1111
var count=0;
1212
var title = $("h1.course-topbanner-header a");
1313
title = title.attr("href").replace(/[/]/g,'');
14+
var host = 'http://127.0.0.1:8000';
1415
chrome.runtime.sendMessage({
1516
method: 'GET',
1617
action: 'xhttp',
17-
url: 'http://127.0.0.1:8000',
18+
url: host,
1819
app:'courseInfo',
1920
data: title
2021
}, function(responseText) {
2122
var courseInfo = JSON.parse(responseText);
2223
//alert(courseInfo.course.length);
2324
for(var i =0;i<linked.length;i++){
2425
var content = linked[i].innerText;
26+
var keyword = "(([Pp]roblem|[Qq]uizz*|[Qq]uestion|[Ee]xam|[Mm]odule|[Ll]ecture|[Ss]lide|[Vv]ideo|[Hh]omework|[Ww]eek)( *[0-9]+( *[\.--]? *[0-9]+| *))(?![0-9]*%))";
27+
28+
var reg = new RegExp(keyword,'ig');
2529
var reg = /((problem|quizz*|question|exam|module|lecture|slide|video|homework|week) *(\d+ *[-\.] *\d+|\d+))/igm;
2630
var patt = content.match(reg);
2731
while ((result = reg.exec(content)) !== null) {
@@ -39,9 +43,9 @@
3943
}else if(result[3].indexOf('.')>-1){
4044
var subResult = result[3].split(".");
4145
}
42-
linked[i].innerHTML=linked[i].innerHTML.replace(result[0],"<a style=\"color:green\" href=\"http://127.0.0.1:8000\\resolve\\"+title+"\\"+result[2].toLowerCase().trim()+"\\"+subResult[0].trim()+"\\section\\"+subResult[1].trim()+"\">"+result[0].trim()+"</a>");
46+
linked[i].innerHTML=linked[i].innerHTML.replace(result[0],"<a style=\"color:green\" href=\""+host+"\\resolve\\"+title+"\\"+result[2].toLowerCase().trim()+"\\"+subResult[0].trim()+"\\section\\"+subResult[1].trim()+"\">"+result[0].trim()+"</a>");
4347
}else{
44-
linked[i].innerHTML=linked[i].innerHTML.replace(result[0],"<a style=\"color:green\" href=\"http://127.0.0.1:8000\\resolve\\"+title+"\\"+result[2].toLowerCase().trim()+"\\"+result[3].trim()+"\">"+result[0].trim()+"</a>");
48+
linked[i].innerHTML=linked[i].innerHTML.replace(result[0],"<a style=\"color:green\" href=\""+host+"\\resolve\\"+title+"\\"+result[2].toLowerCase().trim()+"\\"+result[3].trim()+"\">"+result[0].trim()+"</a>");
4549
}
4650

4751

@@ -78,10 +82,10 @@
7882
var group = re2.exec(linked[i].innerHTML);
7983
if (group!=null&&result.match(group[2])){
8084
linked[i].innerHTML=linked[i].innerHTML.replace(group[0],group[2]);
81-
linked[i].innerHTML=linked[i].innerHTML.replace(result,"<a style = \"color: green\" name = \"concret\" href=\"http://127.0.0.1:8000\\resolve\\"+title+"\\"+"lecture"+"\\"+videos[m].video+"\">"+result+"</a>");
85+
linked[i].innerHTML=linked[i].innerHTML.replace(result,"<a style = \"color: green\" name = \"concret\" href=\""+host+"\\resolve\\"+title+"\\"+"lecture"+"\\"+videos[m].video+"\">"+result+"</a>");
8286
}else
8387
{
84-
linked[i].innerHTML=linked[i].innerHTML.replace(result,"<a style = \"color: green\" name = \"concret\" href=\"http://127.0.0.1:8000\\resolve\\"+title+"\\"+"lecture"+"\\"+videos[m].video+"\">"+result+"</a>");
88+
linked[i].innerHTML=linked[i].innerHTML.replace(result,"<a style = \"color: green\" name = \"concret\" href=\""+host+"\\resolve\\"+title+"\\"+"lecture"+"\\"+videos[m].video+"\">"+result+"</a>");
8589
}
8690
}
8791

@@ -109,7 +113,7 @@
109113
var index = content.substring(content.indexOf(child),content.indexOf(parent)+parent.length);
110114
//alert(index);
111115
//alert(content.indexOf(index));
112-
linked[i].innerHTML = content.replace(index,"<a style = \"color: green\" cls = \"inherit\" parent = \"lecture\" child = \"slide\" href = \"http://127.0.0.1:8000\\resolve\\"+title+"\\"+a[new_iter].innerHTML.split(" ")[0].toLowerCase()+"\\"+String(a[new_iter].innerHTML).match(reg3)[0] + "\\"+a[a_iter].innerHTML.split(" ")[0].toLowerCase()+"\\"+String(a[a_iter].innerHTML).match(reg3)[0]+"\">"+a[a_iter].innerHTML+" of "+a[new_iter].innerHTML+"</a>");
116+
linked[i].innerHTML = content.replace(index,"<a style = \"color: green\" cls = \"inherit\" parent = \"lecture\" child = \"slide\" href = \""+host+"\\resolve\\"+title+"\\"+a[new_iter].innerHTML.split(" ")[0].toLowerCase()+"\\"+String(a[new_iter].innerHTML).match(reg3)[0] + "\\"+a[a_iter].innerHTML.split(" ")[0].toLowerCase()+"\\"+String(a[a_iter].innerHTML).match(reg3)[0]+"\">"+a[a_iter].innerHTML+" of "+a[new_iter].innerHTML+"</a>");
113117

114118
;
115119
;

wikiDemo/courseInfo/__init__.pyc

8 Bytes
Binary file not shown.

wikiDemo/courseInfo/admin.pyc

8 Bytes
Binary file not shown.
16 Bytes
Binary file not shown.
8 Bytes
Binary file not shown.

wikiDemo/courseInfo/models.pyc

16 Bytes
Binary file not shown.

wikiDemo/courseInfo/views.pyc

16 Bytes
Binary file not shown.

wikiDemo/ghostdriver.log

-1.55 KB
Binary file not shown.

wikiDemo/learn/__init__.pyc

12 Bytes
Binary file not shown.

wikiDemo/learn/admin.pyc

12 Bytes
Binary file not shown.
24 Bytes
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
12 Bytes
Binary file not shown.

wikiDemo/learn/models.pyc

36 Bytes
Binary file not shown.

wikiDemo/learn/pageAnalyst.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
def analyse(post):
2121
struct = st.struct()
2222
struct.title = str()
23-
driver = webdriver.PhantomJS("\\utilities\\phantomJS\\bin\\phantomjs.exe")
23+
driver = webdriver.PhantomJS("phantomjs.exe")
2424
site = "https://class.coursera.org/"+post+"/lecture"
2525
print site
2626
driver.get(site)
@@ -30,12 +30,12 @@ def analyse(post):
3030
WebDriverWait(driver,5).until(
3131
EC.presence_of_element_located((By.TAG_NAME,"form")))
3232
form = driver.find_element_by_class_name("c-user-modal-content").find_element_by_tag_name("form")
33-
email = form.find_element_by_xpath("//input[@tabindex='10015']")
33+
email = form.find_element_by_xpath("//input[@tabindex='10013']")
3434
email.send_keys("[email protected]")
3535

36-
pwd = form.find_element_by_xpath("//input[@tabindex='10016']")
37-
pwd.send_keys("vM4HzTcN")
38-
button = form.find_element_by_xpath("//button[@tabindex='10018']")
36+
pwd = form.find_element_by_xpath("//input[@tabindex='10014']")
37+
pwd.send_keys("csiscdtlLIFT-15")
38+
button = form.find_element_by_xpath("//button[@tabindex='10016']")
3939
button.click()
4040
except Exception:
4141
print 'error in login'
@@ -137,5 +137,5 @@ def prettyInfo(archs):
137137
print courseName
138138
analyse(courseName.rstrip())
139139
"""
140-
#courseVideo.objects.all()
141-
analyse('3d-motion')
140+
courseVideo.objects.all()
141+
#analyse('3d-motion')

wikiDemo/learn/urldeode.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def decode(dict):
99
terms = int(dict['section'][0]);
1010
chapter = int(dict['section'][1]);
1111
print os.path.abspath(os.curdir)
12-
driver = webdriver.PhantomJS(os.getcwd()+"\\learn\\utilities\\phantomJS\\bin\\phantomjs.exe")
12+
driver = webdriver.PhantomJS("phantomjs.exe")
1313
#driver = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
1414
site_url = "https://class.coursera.org/"+dict['course']+"/lecture"
1515
print site_url
@@ -29,7 +29,7 @@ def decode(dict):
2929
email.send_keys("[email protected]")
3030
print "find email"
3131
pwd = form.find_element_by_xpath("//input[@tabindex='10014']")
32-
pwd.send_keys("vM4HzTcN")
32+
pwd.send_keys("csiscdtlLIFT-15")
3333
print "find password"
3434
button = form.find_element_by_xpath("//button[@tabindex='10016']")
3535
button.click()

wikiDemo/learn/urldeode.pyc

-45 Bytes
Binary file not shown.

wikiDemo/phantomjs.exe

46.4 MB
Binary file not shown.

wikiDemo/resolve/__init__.pyc

12 Bytes
Binary file not shown.

wikiDemo/resolve/admin.pyc

12 Bytes
Binary file not shown.
12 Bytes
Binary file not shown.

wikiDemo/resolve/models.pyc

12 Bytes
Binary file not shown.

wikiDemo/resolve/views.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,15 @@ def redirect(request,para):
3030
post['course'] = para[0]
3131
post['object'] = para[1]
3232
post['chapter'] = para[2]
33-
try:
34-
link = courseVideo.objects.filter(courseName = post['course'],videoName = post['chapter'])[0].resource_link
35-
except:
36-
pass
37-
print link
38-
return HttpResponseRedirect(link)
33+
if post['chapter'].isdigit() is False:
34+
try:
35+
link = courseVideo.objects.filter(courseName = post['course'],videoName = post['chapter'])[0].resource_link
36+
return HttpResponseRedirect(link)
37+
except:
38+
pass
39+
else:
40+
return HttpResponseRedirect("https://class.coursera.org/"+post['course']+"/"+"lecture")
41+
3942
elif list(para).count('lecture') != 0 and para.count('slide') !=0:
4043
post['course'] = para[0]
4144
post['object'] = para[1]

wikiDemo/resolve/views.pyc

73 Bytes
Binary file not shown.

wikiDemo/wikiDemo/__init__.pyc

8 Bytes
Binary file not shown.

wikiDemo/wikiDemo/settings.pyc

8 Bytes
Binary file not shown.

wikiDemo/wikiDemo/urls.pyc

0 Bytes
Binary file not shown.

wikiDemo/wikiDemo/wsgi.pyc

8 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)