diff --git a/static/application.css b/static/application.css index 8bd3131..70458c0 100644 --- a/static/application.css +++ b/static/application.css @@ -36,6 +36,18 @@ textarea { user-select: none; } +.line { + /* display: block;*/ +} + +.line:hover { + background-color: #cbd387; +} + +.lineHighlight { + background-color: yellow; +} + /* code box when locked */ #box { diff --git a/static/application.js b/static/application.js index ce6c741..a8af5be 100644 --- a/static/application.js +++ b/static/application.js @@ -47,20 +47,19 @@ haste_document.prototype.load = function(key, callback, lang) { currentLine <= selectedLines.endLine ) { highlighted = - '' + highlighted + ""; + "" + highlighted + ""; } - - highlighted = "" + highlighted + ""; + highlighted = "" + highlighted + ""; high.value += highlighted + "\n"; } - // scroll to position in document after ensuring components have had time to render + // scroll to position in document after ensuring components h"ve had time to render setTimeout(function() { // show current line and the one before it if (selectedLines.startLine >= 3) { document.body.scrollTo(0, $("#line-" + (selectedLines.startLine - 2)).offset().top) } else { // if lines 1-2, go to top of file - document.body.scrollTop(0); + document.body.scrollTo(0, 0); } }, 0); } catch (err) { @@ -423,5 +422,4 @@ $(function() { } } }); - -}); +}); \ No newline at end of file diff --git a/static/index.html b/static/index.html index 41a87ff..6bfea97 100644 --- a/static/index.html +++ b/static/index.html @@ -1,100 +1,105 @@ - + - hastebin - - - + hastebin + + + - - - + + + - + - + return { + startLine: start, + endLine: end, + }; + } - + // Construct app and load initial path + $(function () { + var baseUrl = window.location.href.split('#')[0].split('/'); + baseUrl = baseUrl.slice(0, baseUrl.length - 1).join('/') + '/'; + console.log(baseUrl); + const selectedLines = getSelectedLinesFromURL(); + console.log(selectedLines); + app = new haste('hastebin', { twitter: false, baseUrl: baseUrl, selectedLines: selectedLines }); + handlePop({ target: window }); + }); - - + function handleLineClick(lineId) { + /* TODO */ + window.location.hash = "#L" + (lineId + 1); + } + -
- -
- -
-
- - - - - -
- + + + + + +
+ +
+
+
+ + + + + +
+ +
-
- - +
+ + - + - + \ No newline at end of file