File tree 3 files changed +12
-5
lines changed
3 files changed +12
-5
lines changed Original file line number Diff line number Diff line change 12
12
* Global Variables
13
13
******************************************************************************/
14
14
15
- const LATEST_API_VERSION = "0.0.1" ;
16
- // const LATEST_API_VERSION = "0.2.0";
15
+ const LATEST_API_VERSION = "0.2.0" ;
17
16
18
17
var apiVersions = { } ;
19
18
@@ -31,12 +30,19 @@ apiVersions["0.2.0"] = {
31
30
getViewLink : function ( pageData ) {
32
31
var urlData = {
33
32
version : this . VERSION ,
33
+ compressed : false ,
34
+ body : pageData ,
34
35
} ;
35
36
36
37
const hashObject = b64 . encode ( JSON . stringify ( urlData ) ) ;
37
38
return `http://jstrieb.github.io/urlpages/#${ hashObject } ` ;
38
39
} ,
39
40
41
+ /* Return the page data from the object */
42
+ decode : function ( urlData ) {
43
+ return urlData . body ;
44
+ } ,
45
+
40
46
}
41
47
42
48
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ function setViewUrl() {
50
50
"html" : document . getElementById ( "html" ) . value
51
51
} ;
52
52
53
- var html = encodeURIComponent ( getHTML ( data ) ) ;
53
+ var html = getHTML ( data ) ;
54
54
55
55
// Update the URL for the "Short Link" button
56
56
document . getElementById ( "url" ) . value = api . getViewLink ( html ) ;
@@ -118,7 +118,7 @@ function update() {
118
118
"html" : document . getElementById ( "html" ) . value
119
119
} ;
120
120
121
- var html = encodeURIComponent ( getHTML ( data ) ) ;
121
+ var html = getHTML ( data ) ;
122
122
123
123
// Save encoded page data to the URL
124
124
window . location . hash = "#" + b64 . encode ( JSON . stringify ( data ) ) ;
@@ -130,5 +130,5 @@ function update() {
130
130
document . getElementById ( "downloadLink" ) . href = `data:text/html,${ html } `
131
131
132
132
// Update the <iframe> to display the generated page
133
- window . frames [ 0 ] . location . replace ( `data:text/html;charset=utf-8;base64,${ b64 . encode ( decodeURIComponent ( html ) ) } ` ) ;
133
+ window . frames [ 0 ] . location . replace ( `data:text/html;charset=utf-8;base64,${ b64 . encode ( html ) } ` ) ;
134
134
}
Original file line number Diff line number Diff line change 6
6
< noscript > JavaScript is required to convert the URL into a usable web page.</ noscript >
7
7
8
8
< script type ="text/javascript " src ="b64.js "> </ script >
9
+ < script type ="text/javascript " src ="api.js "> </ script >
9
10
< script type ="text/javascript ">
10
11
if ( window . location . hash ) {
11
12
// Try to get page data from the URL if possible
You can’t perform that action at this time.
0 commit comments