@@ -23,59 +23,63 @@ var ed = {
2323 document . cookie = key + "=" + value + expires + "; path=/" ;
2424 } ,
2525 getNasAuthUrl : function ( ) {
26- ed . setCookie ( 'EdSynoToken ' , "" ) ;
26+ ed . setCookie ( 'RiVSynoToken ' , "" ) ;
2727 var url = ed . getCookie ( 'origin' ) ;
2828 if ( url === undefined ) {
2929 url = window . location . protocol + "//" + window . location . hostname + ":" + 5000 ;
3030 }
3131 return url ;
3232 }
3333} ;
34- $ ( function ( ) {
35- function params ( obj ) {
36- if ( typeof obj === 'string' ) {
37- if ( obj [ 0 ] === '?' ) {
38- obj = obj . substring ( 1 ) ;
39- }
40- var result = { } ;
41- obj = obj . split ( "&" ) ;
42- obj . forEach ( function ( pair ) {
43- pair = pair . split ( "=" ) ;
44- var key = decodeURIComponent ( pair [ 0 ] ) ;
45- var value = decodeURIComponent ( pair [ 1 ] ) ;
46- // If first entry with this name
47- if ( typeof result [ key ] === "undefined" ) {
48- result [ key ] = value ;
49- // If second entry with this name
50- } else if ( typeof result [ key ] === "string" ) {
51- result [ key ] = [ result [ key ] , value ] ;
52- // If third or later entry with this name
53- } else {
54- result [ key ] . push ( value ) ;
55- }
56- } ) ;
57- return result ;
58- } else {
59- return Object . keys ( obj ) . map ( function ( key ) {
60- return encodeURIComponent ( key ) + '=' + encodeURIComponent ( obj [ key ] ) ;
61- } ) . join ( '&' ) ;
62- }
63- } ;
64- //Hide URL parameters
65- var query = params ( window . location . search . substring ( 1 ) ) ;
66- var refresh = false ;
67- for ( var k in query ) {
68- if ( k === 'SynoToken' ) {
69- ed . setCookie ( 'EdSynoToken' , query [ k ] ) ;
70- refresh = true ;
71- delete query [ k ] ;
72- } else if ( k === 'origin' ) {
73- ed . setCookie ( 'origin' , query [ k ] ) ;
74- refresh = true ;
75- delete query [ k ] ;
34+
35+ function params ( obj ) {
36+ if ( typeof obj === 'string' ) {
37+ if ( obj [ 0 ] === '?' ) {
38+ obj = obj . substring ( 1 ) ;
7639 }
40+ var result = { } ;
41+ obj = obj . split ( "&" ) ;
42+ obj . forEach ( function ( pair ) {
43+ pair = pair . split ( "=" ) ;
44+ var key = decodeURIComponent ( pair [ 0 ] ) ;
45+ var value = decodeURIComponent ( pair [ 1 ] ) ;
46+ // If first entry with this name
47+ if ( typeof result [ key ] === "undefined" ) {
48+ result [ key ] = value ;
49+ // If second entry with this name
50+ } else if ( typeof result [ key ] === "string" ) {
51+ result [ key ] = [ result [ key ] , value ] ;
52+ // If third or later entry with this name
53+ } else {
54+ result [ key ] . push ( value ) ;
55+ }
56+ } ) ;
57+ return result ;
58+ } else {
59+ return Object . keys ( obj ) . map ( function ( key ) {
60+ return encodeURIComponent ( key ) + '=' + encodeURIComponent ( obj [ key ] ) ;
61+ } ) . join ( '&' ) ;
62+ }
63+ } ;
64+ //Hide URL parameters
65+ var query = params ( window . location . search . substring ( 1 ) ) ;
66+ var refresh = false ;
67+ for ( var k in query ) {
68+ if ( k === 'SynoToken' ) {
69+ ed . setCookie ( 'RiVSynoToken' , query [ k ] ) ;
70+ refresh = true ;
71+ delete query [ k ] ;
72+ } else if ( k === 'origin' ) {
73+ ed . setCookie ( 'origin' , query [ k ] ) ;
74+ refresh = true ;
75+ delete query [ k ] ;
7776 }
78- query = $ . param ( query ) ;
79- if ( refresh )
80- window . location . replace ( window . location . origin + window . location . pathname + window . location . hash + ( ( query === "" ) ? "" : ( "?" + query ) ) ) ;
81- } ) ;
77+ }
78+
79+ query = Object . keys ( query ) . map ( function ( k ) {
80+ return encodeURIComponent ( k ) + '=' + encodeURIComponent ( query [ k ] )
81+ } ) . join ( '&' ) ;
82+
83+ if ( refresh )
84+ window . location . replace ( window . location . origin + window . location . pathname + window . location . hash + ( ( query === "" ) ? "" : ( "?" + query ) ) ) ;
85+
0 commit comments