@@ -917,8 +917,6 @@ themePicker.onclick = function() {{
917
917
themePicker.style.borderBottomLeftRadius = "0";
918
918
}}
919
919
}};
920
- var currentTheme = document.getElementById("themeStyle");
921
- var mainTheme = document.getElementById("mainThemeStyle");
922
920
[{}].forEach(function(item) {{
923
921
var div = document.createElement('div');
924
922
div.innerHTML = item;
@@ -927,32 +925,13 @@ var mainTheme = document.getElementById("mainThemeStyle");
927
925
}};
928
926
themes.appendChild(div);
929
927
}});
930
-
931
- function updateLocalStorage(theme) {{
932
- if (typeof(Storage) !== "undefined") {{
933
- localStorage.theme = theme;
934
- }} else {{
935
- // No Web Storage support so we do nothing
936
- }}
937
- }}
938
- function switchTheme(styleElem, mainStyleElem, newTheme) {{
939
- styleElem.href = mainStyleElem.href.replace("rustdoc.css", newTheme + ".css");
940
- updateLocalStorage(newTheme);
941
- }}
942
- function getCurrentTheme() {{
943
- if (typeof(Storage) !== "undefined" && localStorage.theme !== undefined) {{
944
- return localStorage.theme;
945
- }}
946
- return "main";
947
- }}
948
-
949
- switchTheme(currentTheme, mainTheme, getCurrentTheme());
950
928
"# , themes. iter( )
951
929
. map( |s| format!( "\" {}\" " , s) )
952
930
. collect:: <Vec <String >>( )
953
931
. join( "," ) ) . as_bytes ( ) ) ?;
954
932
955
933
write ( cx. dst . join ( "main.js" ) , include_bytes ! ( "static/main.js" ) ) ?;
934
+ write ( cx. dst . join ( "storage.js" ) , include_bytes ! ( "static/storage.js" ) ) ?;
956
935
957
936
if let Some ( ref css) = cx. shared . css_file_extension {
958
937
let out = cx. dst . join ( "theme.css" ) ;
0 commit comments