Skip to content

Commit 1c5d6ba

Browse files
committed
Adjusted web page for mobile use
1 parent 3702b06 commit 1c5d6ba

File tree

4 files changed

+29
-16
lines changed

4 files changed

+29
-16
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.idea
22
.Rhistory
3+
.vscode

index.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@
33

44
<head>
55
<meta charset="utf-8">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
67
<title>Comprehensive Python Cheatsheet</title>
78
<link rel="icon" href="web/favicon.png">
8-
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
9-
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
10-
<script src="web/showdown.min.js"></script>
119
<link rel="stylesheet" href="web/default.min.css">
12-
<script src="web/highlight.min.js"></script>
13-
<script src="web/script.js"></script>
1410
<meta name="twitter:card" content="summary">
1511
<meta name="twitter:title" content="Comprehensive Python Cheatsheet">
1612
<meta name="twitter:description" content="Exhaustive, simple, beautiful and concise. A truly pythonic cheat sheet about Python programming language.">
@@ -163,5 +159,10 @@
163159
<br>
164160
<br>
165161
<br>
162+
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
163+
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
164+
<script src="web/showdown.min.js"></script>
165+
<script src="web/highlight.min.js"></script>
166+
<script src="web/script.js"></script>
166167
</body>
167-
</html>
168+
</html>

web/script.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ function removeOrigToc() {
2626

2727
function insertLinks() {
2828
$('h2').each(function() {
29-
aId = $(this).attr('id');
30-
$(this).append('<a href="#'+aId+'" name="'+aId+'">#</a>');
31-
});
29+
aId = $(this).attr('id')
30+
text = $(this).text()
31+
$(this).html('<a href="#'+aId+'" name="'+aId+'">#</a>'+text)
32+
})
3233
}
3334

3435
function addToc() {

web/style.css

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11

22
/* Copyright 2013 Michael Bostock. All rights reserved. Do not copy. */
33

4-
@import url(//fonts.googleapis.com/css?family=PT+Serif|PT+Serif:b|PT+Serif:i|PT+Sans|PT+Sans:b);
4+
@import url(https://fonts.googleapis.com/css?family=PT+Serif|PT+Serif:b|PT+Serif:i|PT+Sans|PT+Sans:b);
55

6-
html {
7-
min-width: 1040px;
8-
}
96

107
.ocks-org body {
118
background: #fcfcfa;
@@ -56,9 +53,7 @@ h1, h2 {
5653
h2 a[name],
5754
h2 a[id] {
5855
color: #ccc;
59-
right: 100%;
6056
padding: 0 .3em;
61-
position: absolute;
6257
}
6358

6459
header,
@@ -143,7 +138,7 @@ textarea {
143138
body > pre {
144139
border-left: solid 2px #ccc;
145140
padding-left: 18px;
146-
margin: 2em 0 2em -20px;
141+
margin: 2em 0 2em 0;
147142
}
148143

149144
.html .value,
@@ -219,3 +214,18 @@ blockquote q:before,
219214
blockquote q:after {
220215
content: "";
221216
}
217+
218+
@media only screen
219+
and (max-device-width : 1024px){
220+
.ocks-org body {
221+
margin: 1rem;
222+
}
223+
224+
h1{
225+
font-size: 3rem;
226+
}
227+
p, h1, img{
228+
max-width: calc(100vw - 2em);
229+
min-width: calc(100vw - 2em);
230+
}
231+
}

0 commit comments

Comments
 (0)