-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Elizabeth Margolin
authored and
Elizabeth Margolin
committed
Sep 12, 2017
0 parents
commit b170d66
Showing
21 changed files
with
3,281 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Save Telegram Chat History | ||
-------------------------- | ||
|
||
###Why this extension? | ||
Perhaps, many of us use and like Telegram messenger for conversations with friends. However, we were a bit disappointed by the absence of any sort of easy-accessible "Save Conversation" feature in the messenger. Therefore, we've written a Chrome extension for it! | ||
|
||
###How It Works | ||
- Install the Chrome extension ["Save Telegram Chat History"](https://chrome.google.com/webstore/detail/save-telegram-chat-histor/kgldnbjoeinkkgpphaaljlfhfdbndfjc?hl=en). You should now see a new icon in the browser. | ||
- Visit https://web.telegram.org. | ||
- Select a peer you want to get history from. | ||
- Click on the icon "Save Telegram Chat History". | ||
- In the popup window click one of the buttons to fetch some messages, then 'Save As' to a local file. | ||
- Congratulations! You are done. | ||
|
||
|
||
###Features | ||
* Shows your chat history with a Telegram peer or a group as text. | ||
* Works even for DELETED accounts. | ||
* Browse photos depending on the cursor position or as a list, with possibility to save one by one (since 2.1.0). | ||
* Fetching history without scrolling (since 2.0.0). | ||
* You can configure the output format (since 1.3.0). | ||
|
||
###Requirements | ||
* Chrome browser (48+), not tested on older versions. | ||
* Supported languages of web interface are English, German, Spanish, Italian, Dutch, and Portuguese. | ||
|
||
###Feedback | ||
If you have any feedback, feel free to visit us at https://github.com/pigpagnet/save-telegram-chat-history. The code is open-source. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
###Release Notes | ||
|
||
February 2017 --- Version 2.1.1 | ||
* Fixed the options page | ||
|
||
February 13, 2017 --- Version 2.1.0 | ||
* Opens a list of all photos with possibility to navigate | ||
* Opens previous or next photo based on cursor in the chat log | ||
* Shows the time progress after 1.0 sec. | ||
* Remembers the scroll position | ||
|
||
|
||
October 4, 2016 --- Version 2.0.0 | ||
* Faster loading history through the angular model | ||
|
||
|
||
September 10, 2016 --- Version 1.3.1 | ||
* Supported multiple languages | ||
* Added diagnostic messages | ||
|
||
|
||
July 24, 2016 --- Version 1.3.0 | ||
* Added options to configure the output format | ||
|
||
|
||
July 6, 2016 --- Version 1.2.0 | ||
* Improved efficiency | ||
* Added autoscroll history | ||
|
||
|
||
June 16, 2016 --- Version 1.1.0 | ||
* Fixed parsing date format | ||
|
||
|
||
February 7, 2016 --- Version 1.0.0 | ||
* Initial release | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<script type="text/javascript"> | ||
var textAreaScroll = 0 | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
function inject_script(script_name){ | ||
var s = document.createElement('script'); | ||
s.src = chrome.extension.getURL(script_name); | ||
(document.head||document.documentElement).appendChild(s); | ||
//s.onload = function() { | ||
// s.parentNode.removeChild(s); | ||
//}; | ||
} | ||
|
||
inject_script('generic_tools.js') | ||
inject_script('inject.js') | ||
console.log("script injected.") | ||
|
||
document.addEventListener('from_injected', function(e) { | ||
//console.log("sending message with history to extension"); | ||
chrome.runtime.sendMessage({detail: e.detail}, null); | ||
}); | ||
|
||
//----------------------------------- | ||
/*keep_scrolling = false; | ||
function scrollUp(){ | ||
$('.nano.im_history_wrap').nanoScroller({scroll:'top'}); | ||
if (keep_scrolling){ | ||
setTimeout(scrollUp, 1000); | ||
} | ||
}*/ | ||
|
||
chrome.runtime.onMessage.addListener(function (request_msg, sender, sendResponse) { | ||
console.log('content script received request '+request_msg.text); | ||
if (request_msg.text === 'stch_check_conn') { | ||
sendResponse({text : "OK"}) | ||
} | ||
if (request_msg.text === 'stch_load_current_history') { | ||
document.dispatchEvent(new CustomEvent('to_injected_current', {})); | ||
} | ||
if (request_msg.text === 'stch_load_more_history') { | ||
document.dispatchEvent(new CustomEvent('to_injected_get_more', | ||
{'detail':request_msg.value})); | ||
} | ||
if (request_msg.text === 'stch_open_photos') { | ||
document.dispatchEvent(new CustomEvent('to_injected_open_photos', | ||
{'detail':request_msg.value})); | ||
} | ||
/*if (request_msg.text === 'stch_start_scrolling_up'){ | ||
keep_scrolling = true; | ||
scrollUp(); | ||
} | ||
if (request_msg.text === 'stch_stop_scrolling'){ | ||
keep_scrolling = false; | ||
}*/ | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
// Message format | ||
defaultMapFormats = { | ||
formatCompact:"dt, u: m", | ||
formatLarge:"u [dt]\\nm\\n", | ||
formatCustom:"", | ||
selected:"formatCompact", | ||
}; | ||
|
||
function formatMsg(format, datetime, username, text){ | ||
var msg = format; | ||
var mapObj = { | ||
dt:datetime, | ||
d:datetime.substring(0,10), | ||
t:datetime.substring(11,19), | ||
u:username, | ||
m:text, | ||
}; | ||
var re = new RegExp(Object.keys(mapObj).join("|"),"gi"); | ||
msg = msg.replace(re, function(matched){ | ||
return mapObj[matched]; | ||
}); | ||
return msg; | ||
} | ||
|
||
function prepareFormat(format) { | ||
format = format.replace(/\\n/g, "\n"); | ||
format = format.replace(/\\t/g, "\t"); | ||
return format; | ||
} | ||
|
||
|
||
|
||
|
||
// Argument is of type Date. | ||
// Some examples: | ||
// d = new Date(); // current date | ||
// d.setMonth(d.getMonth() - 3); // set 3 month prior to date | ||
function formatDate(d){ | ||
return lead(d.getDate())+'.'+lead(d.getMonth()+1)+'.'+d.getFullYear() + ' ' | ||
+ lead(d.getHours()) + ':' + lead(d.getMinutes()) + ':' + lead(d.getSeconds()); | ||
//Example of output 31.12.2016 23:59:59 | ||
} | ||
|
||
function formatDateForFileName(d){ | ||
return d.getFullYear() + '_' +lead(d.getMonth()+1)+'_' + lead(d.getDate()) +'--' | ||
+ lead(d.getHours()) + '-' + lead(d.getMinutes()) + '-' + lead(d.getSeconds()); | ||
} | ||
|
||
function lead(a){ | ||
var s = '0' + a; | ||
if (s.length>2) | ||
s = s.substr(1); | ||
return s; | ||
} | ||
|
||
function friendlySize(size){ | ||
var s = '' + size | ||
var res = s | ||
for(var i=s.length-3; i>0; i-=3){ | ||
res = res.slice(0,i) + "'" + res.slice(i) | ||
} | ||
return res | ||
} | ||
|
||
|
||
function appendWithSpace(input_string, new_part){ | ||
if (new_part.length == 0) | ||
return input_string | ||
if (input_string.length > 0) | ||
return input_string + ' ' + new_part | ||
return input_string + new_part | ||
} | ||
|
||
|
||
function comparatorArithmetic(a,b){ | ||
return a-b | ||
} | ||
|
||
// var arr = [3,4,6] | ||
// binSearch(arr, 5, comparator) | ||
function binSearch(arr, val, comparator) { | ||
if (comparator == null){ | ||
comparator = comparatorArithmetic | ||
} | ||
var left = -1 | ||
var right = arr.length + 1 | ||
while (right - left > 1){ | ||
var mid = Math.floor((right + left) / 2) | ||
var cmp = comparator(arr[mid], val) | ||
if (cmp == 0){ | ||
return mid | ||
} | ||
if (cmp < 0){ | ||
left = mid | ||
}else{ | ||
right = mid | ||
} | ||
} | ||
return -right | ||
} | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.