Skip to content

Commit 7f40ce9

Browse files
pattontimalexis-
andauthored
Beta release of YT extension (#9)
* Add mostly local resource loading and basic react player loading * Button and extract handlers, time bordering, debug * Update .gitignore * Load YT scripts async, speed slider * Fix spurious CORS error, prep fullscreen handler * Implement basic new window timestamp syncingWIP * Add extract sync, remove unneceesary header libs * Implement extracts, window close on nav and re-open * Update readme * Add extract sync on delete, more closely sync with SM parent, add more advanced shortcuts * Rearrange UI elems, sync more elems, add arrow inputs * Update yt.htm * Update README.md * Update image with new UI Co-authored-by: Alexis <[email protected]>
1 parent f86f3d0 commit 7f40ce9

File tree

5 files changed

+1368
-285
lines changed

5 files changed

+1368
-285
lines changed

YouTubeReactExtension/README.md

+44-15
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ SuperMemo YouTube extract performance improvements and extensions.
55

66
## Description
77

8-
Utilize a locally hosted service to remove remote requirements saving up to 500ms per card and utilize the react-player to extend the functionality of incremental video in SM-18.
8+
Fixes SuperMemo memleaks and slowdowns with a popup window. Utilize a locally hosted service to remove remote requirements saving up to 500ms per card and utilize the react-player to extend the functionality of incremental video in SM-18. I now consider this a beta and usable, it won't overwrite your cards under expected operation. However, I recommend that you [backup your collection](https://www.supermemo.wiki/en/supermemo/backup-guide) before starting to use this extension.
9+
10+
![Screenshot](main-screen.png)
911

1012
## Getting Started
1113

1214
### Dependencies
1315

1416
* python2 or 3
15-
* nodejs + npm installed
1617
* SuperMemo 18
1718
* Windows
1819

@@ -22,12 +23,6 @@ Utilize a locally hosted service to remove remote requirements saving up to 500m
2223

2324
* Open the server folder in Terminal
2425

25-
* [not neccessary, binaries already provided] Install the react player.
26-
27-
```
28-
npm install react-player # or yarn add react-player
29-
```
30-
3126
* Start the server to host resources. Uses port 8000 by default.
3227
```
3328
python -m SimpleHTTPServer
@@ -38,26 +33,60 @@ python3 -m http.server
3833

3934
* backup YouTube.htm in your install SuperMemo/bin folder
4035

41-
* if above succeeds, replace YouTube.htm to your installs SuperMemo/bin folder with the one provided in this ZIP. Or simply replace:
42-
```
43-
sBaseUrl = "http://localhost:8000/yt.htm?"
44-
```
36+
* if above succeeds, replace YouTube.htm to your installs SuperMemo/bin folder with the one provided in this ZIP
4537

4638
## Help
4739

48-
Not currently finished.
40+
### One of my extract timestamps wiped!?
41+
42+
This can rarely happen if you hold ALT+LEFT or ALT+RIGHT and cycle theough many cards quickly. You may recover the times from the title of the card.
43+
44+
### The Player is too small, out of place, etc..
45+
46+
Adjust top, left, width and height in sep_embed to adjust screen placement.
47+
48+
### Known bugs
49+
50+
- Closing a player with extracts on it and using the Reopen button will result in errors when making even more extracts.
51+
52+
### Differences with vanilla supermemo
53+
54+
- Extract background colour is lost (blue)
55+
- Clicking fields inserts current time
4956

5057
## Version History
5158

52-
* 0.1 WIP
59+
* 0.1
5360
* Mark/Stop/Start buttons work
5461
* Loading YouTube videos
5562
* Loads SM scripts locally
63+
* 0.2
64+
* Nonblocking player and hotkeys
65+
* Playback speed slider
66+
* 0.3 BETA
67+
* Bypass MEMLEAK in supermemo
68+
* Load external IE window with YT player
69+
* Changes reflect back to SM
70+
* Extracts and navigation work
71+
* Start, Stop, Mark textbox can be clicked to set times
72+
* Everything in the UI works
73+
### Roadmap
74+
* Title extract verification for timing overwrite error
75+
* Pleasing layout
76+
* Window fullscreen
77+
* Serverside:
78+
* Store playback speeds
79+
* File-YT proxy for lightning fast plays
80+
* More shortcuts such as fullscreen, extract setting using keys, etc...
81+
* Visualize extracts on timeline
82+
- Enter to OK
83+
* SupermemoAssistant plugin to re-use player and make a YouTube Jukebox
84+
* Browser plugin and YouTube player integration
5685

5786
## License
5887

5988
Inherits license in the root of the project.
6089

6190
## Acknowledgments
6291

63-
* [SuperMemo yt.htm](https://www.super-memory.com/)
92+
* [SuperMemo yt.htm](https://www.super-memory.com/)

YouTubeReactExtension/main-screen.png

615 KB
Loading

YouTubeReactExtension/server/YouTube.htm

+57-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,40 @@
1111
<input type="text" value="0:00:00" id="resumevideoat" onfocus="this.select();" ondblclick="resetAt('resume');" onchange="this.value = convertDuration2HHMMSS(convertHHMMSS2Duration(this.value));" />
1212
<input type="text" value="0:00:00" id="startvideoat" onfocus="this.select();" onchange="this.value = convertDuration2HHMMSS(convertHHMMSS2Duration(this.value)); document.getElementById('imposeboundries').value = 0; updateBorder(this);" ondblclick="resetAt('start');" />
1313
<input type="text" value="0:00:00" id="stopvideoat" onfocus="this.select();" onchange="this.value = convertDuration2HHMMSS(convertHHMMSS2Duration(this.value)); document.getElementById('imposeboundries').value = 0; updateBorder(this);" ondblclick="resetAt('stop');" />
14+
<div class="ctrlGrp">
15+
<textarea id="log" style="width: 100%"></textarea>
16+
</div>
1417
<script type="text/javascript">
18+
// define a new console
19+
var console=(function(oldCons){
20+
var oLog = document.getElementById("log");
21+
return {
22+
log: function(text){
23+
//oldCons.log(text);
24+
oLog.innerHTML += '[LOG] ' + text + '\n';
25+
},
26+
info: function (text) {
27+
//oldCons.info(text);
28+
// Your code
29+
oLog.innerHTML += '[INFO] ' + text + '\n';
30+
},
31+
warn: function (text) {
32+
//oldCons.warn(text);
33+
// Your code
34+
oLog.innerHTML += '[WARN] ' + text + '\n';
35+
//alert( '[WARN] ' + text + '\n')
36+
},
37+
error: function (text) {
38+
//oldCons.error(text);
39+
// Your code
40+
oLog.innerHTML += '[ERROR] ' + text + '\n';
41+
}
42+
};
43+
}(window.console));
44+
45+
//Then redefine the old console
46+
window.console = console;
47+
1548
var buildUrlString = function() {
1649
var urlString = "",
1750
oTs = new Date(),
@@ -33,10 +66,31 @@
3366

3467
return urlString;
3568
},
69+
sProtocol = 'microsoft-edge',
3670
sBaseUrl = "http://localhost:8000/yt.htm?",
71+
sBaseHeaderUrl = "http://localhost:8000/yt_header.htm?",
3772
sUrlString = buildUrlString();
38-
39-
document.location.href = sBaseUrl + sUrlString;
40-
</script>
73+
74+
/*
75+
* Select one of the following default behaviours
76+
* A) Open in SM window (memory leak)
77+
* B) Open in new IE11 window every time
78+
* [unfinished] C) Open in Edge window
79+
*/
80+
81+
/*
82+
* A.
83+
*/
84+
//document.location.href = sBaseUrl + sUrlString;
85+
86+
/*
87+
* B.
88+
*/
89+
document.location.href = sBaseHeaderUrl + sUrlString;
90+
91+
/*
92+
* C.
93+
will use window.open(sProtocol + ':' + sBaseUrl + sUrlString;
94+
*/
4195
</body>
4296
</html>

0 commit comments

Comments
 (0)