JavedA commited on
Commit
3a238b7
β€’
1 Parent(s): 8ed5f8a

loader working - without lottifiles

Browse files
Code/{gls β†’ Gls}/gls_Main.lua RENAMED
File without changes
Data/10_Law/used_Licenses ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # ------------------------------ Pakistan Riksha ----------------------------- #
2
+ Riksha with pakistan flag on it, is obtained through:
3
+ https://lottiefiles.com/103030-rickshaw-from-pakistan
4
+ My thank goes to: https://lottiefiles.com/ranaadeelfarrukh, for this beautiful animation and also the lottifiles initative - thank you for providing this content for free
5
+
6
+ The license of the riksha can be found at: https://lottiefiles.com/page/license
7
+
8
+ Note: I modfied the original content a bit
9
+
Data/7_Animation/Riksha.json ADDED
The diff for this file is too large to render. See raw diff
 
Data/7_Animation/Riksha.lottie ADDED
Binary file (427 kB). View file
 
Data/7_Animation/riksha.lottie ADDED
Binary file (427 kB). View file
 
Data/7_Animation/rissha.json ADDED
The diff for this file is too large to render. See raw diff
 
Python/plot.py DELETED
@@ -1,103 +0,0 @@
1
- import numpy as np
2
- import plotly.io as pio
3
-
4
- # pio.renderers.default = "plotly_mimetype+notebook_connected"
5
-
6
- import plotly.graph_objects as go # to combine figures
7
-
8
- # load data from the numpy npz file
9
- data = np.load('Data/6_Html_Data/0_Viz/plt_Dat_16.78.npz')
10
-
11
- # extraxt the data - load it
12
- x_Traj = data["x"]
13
- y_Traj = data["y"]
14
- z_Traj = data["z"]
15
- x_Cone = data["x_Cone"]
16
- y_Cone = data["y_Cone"]
17
- z_Cone = data["z_Cone"]
18
- u_Cone = data["u_Cone"]
19
- v_Cone = data["v_Cone"]
20
- w_Cone = data["w_Cone"]
21
-
22
- # The trajectory
23
- fig = go.Figure(data=[go.Scatter3d(
24
- x= x_Traj,
25
- y= y_Traj,
26
- z= z_Traj,
27
- name = "Trajectory",
28
- showlegend = False,
29
- )])
30
-
31
-
32
- fig.update_traces(marker_size = 2,
33
- mode = "lines",
34
- marker_color ="green")
35
-
36
-
37
- # Cones
38
- fig_Cones = go.Figure(data=go.Cone( x = x_Cone ,
39
- y = y_Cone ,
40
- z = z_Cone ,
41
- u = u_Cone ,
42
- v = v_Cone ,
43
- w = w_Cone ,
44
- name = "Direction",
45
- showlegend = False,
46
-
47
- )
48
- )
49
-
50
-
51
- # hiding color-bar
52
- fig_Cones.update_traces(showscale=False)
53
-
54
- # combine cone and trajectory
55
- fig.add_traces(data = fig_Cones.data)
56
-
57
-
58
- # style the figure
59
- fig.update_layout(
60
- # plotlyexpress 3d axes:
61
- scene = dict(
62
- xaxis = dict(
63
- showbackground = False,
64
- showticklabels = False,
65
- title='',
66
- showgrid = False,
67
- zeroline = False,),
68
- yaxis = dict(
69
- showbackground = False,
70
- showticklabels = False,
71
- title='',
72
- showgrid = False,
73
- zeroline = False,),
74
- zaxis = dict(
75
- showbackground = False,
76
- showticklabels = False,
77
- title='',
78
- showgrid = False,
79
- zeroline = False,
80
- ),
81
- ),
82
- # template= 'plotly_dark'
83
- # template= 'plotly'
84
- paper_bgcolor='rgba(0,0,0,0)',
85
- plot_bgcolor='rgba(0,0,0,0)',
86
- modebar = dict(bgcolor='rgba(0, 0, 0, 0)'),
87
- margin=dict(
88
- l=0,
89
- r=0,
90
- b=0,
91
- t=0,
92
- pad=0
93
- ),
94
-
95
- scene_camera_eye=dict(x=0,
96
- y=1,
97
- z=0),
98
- )
99
-
100
- fig.show(div_id ="rest")
101
-
102
- a = fig.to_html(div_id ="test_")
103
- print("stop")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Trials/0_Lottifiles_Player.qmd ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Trials
2
+
3
+ Thissince \gls{cnmc}
4
+
5
+ <!-- load lotti js code -->
6
+ <script src="https://unpkg.com/@dotlottie/player-component@1.0.0/dist/dotlottie-player.js"></script>
7
+ <script src="https://unpkg.com/@lottiefiles/lottie-player@1.5.7/dist/lottie-player.js"></script>
8
+
9
+ <lottie-player
10
+ autoplay
11
+ controls
12
+ loop
13
+ mode="normal"
14
+ src="https://assets5.lottiefiles.com/packages/lf20_mHIYUQrfMT.json"
15
+ style="width: 320px">
16
+ </lottie-player>
17
+
18
+ <dotlottie-player
19
+ autoplay
20
+ controls
21
+ loop
22
+ mode="normal"
23
+ src="./Data/7_Animation/Riksha.lottie"
24
+ style="width: 320px"
25
+ >
26
+ </dotlottie-player>
27
+
28
+ <lottie-player
29
+ autoplay
30
+ controls
31
+ loop
32
+ mode="normal"
33
+ src="./Data/7_Animation/Riksha.json"
34
+ style="width: 320px">
35
+ </lottie-player>
36
+
37
+
38
+
39
+
40
+
41
+
42
+ <!-- src="" -->
43
+
44
+
45
+
46
+ <div>
47
+ <h1>Hello, World!</h1>
48
+ <p>This is my first HTML code.</p>
49
+ </div>
50
+
51
+ <div>
52
+ <h1>Hello, World!</h1>
53
+ <script>
54
+ document.write("This text is generated by JavaScript!");
55
+ </script>
56
+ </div>
57
+
58
+
59
+ <div>
60
+ <h1>Final header</h1>
61
+ <p>This is my first HTML code.</p>
62
+ </div>
63
+
64
+
65
+
Web_Code/CSS/css_0.css CHANGED
@@ -44,9 +44,10 @@
44
  margin-top: -60px;
45
  margin-left: -60px;
46
  }
47
-
48
- @keyframes spin {
 
49
  0% { transform: rotate(0deg); }
50
  100% { transform: rotate(360deg); }
51
  }
52
-
 
44
  margin-top: -60px;
45
  margin-left: -60px;
46
  }
47
+
48
+
49
+ @keyframes spin {
50
  0% { transform: rotate(0deg); }
51
  100% { transform: rotate(360deg); }
52
  }
53
+
_quarto.yml CHANGED
@@ -1,5 +1,14 @@
 
 
1
  project:
2
  type: book
 
 
 
 
 
 
 
3
 
4
 
5
  filters:
@@ -12,7 +21,7 @@ filters:
12
  # https://github.com/schochastics/quarto-social-share :MIT
13
  # - social-share
14
 
15
- - Code/gls/gls_Main.lua
16
 
17
  # see: https://github.com/quarto-ext/lightbox
18
  lightbox:
@@ -59,6 +68,7 @@ cluster-based network modeling"
59
  date: "5.3.2023"
60
  page-navigation: true
61
 
 
62
  # --------------------------------- sidebar -------------------------------- #
63
  # see: https://quarto.org/docs/reference/projects/books.html#sidebar
64
  sidebar:
 
1
+ # for all available book options see:
2
+ # https://quarto.org/docs/reference/projects/books.html
3
  project:
4
  type: book
5
+
6
+ # HTML library (JS/CSS/etc.) directory
7
+ # lib-dir: ["Web_Code/CSS/", "Web_Code/Js"]
8
+
9
+ # Additional file resources to be copied to output directory
10
+ resources: ["Data/7_Animation/"]
11
+
12
 
13
 
14
  filters:
 
21
  # https://github.com/schochastics/quarto-social-share :MIT
22
  # - social-share
23
 
24
+ - Code/Gls/gls_Main.lua
25
 
26
  # see: https://github.com/quarto-ext/lightbox
27
  lightbox:
 
68
  date: "5.3.2023"
69
  page-navigation: true
70
 
71
+
72
  # --------------------------------- sidebar -------------------------------- #
73
  # see: https://quarto.org/docs/reference/projects/books.html#sidebar
74
  sidebar:
gls_Init/.gitignore DELETED
@@ -1,4 +0,0 @@
1
- *.html
2
- *.pdf
3
- *_files/
4
- /.luarc.json
 
 
 
 
 
gls_Init/README.md DELETED
@@ -1,23 +0,0 @@
1
- # Gls_Init Extension For Quarto
2
-
3
- _TODO_: Add a short description of your extension.
4
-
5
- ## Installing
6
-
7
- _TODO_: Replace the `<github-organization>` with your GitHub organization.
8
-
9
- ```bash
10
- quarto add <github-organization>/gls_init
11
- ```
12
-
13
- This will install the extension under the `_extensions` subdirectory.
14
- If you're using version control, you will want to check in this directory.
15
-
16
- ## Using
17
-
18
- _TODO_: Describe how to use your extension.
19
-
20
- ## Example
21
-
22
- Here is the source code for a minimal example: [example.qmd](example.qmd).
23
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
gls_Init/example.qmd DELETED
@@ -1,11 +0,0 @@
1
- ---
2
- title: "Gls_Init Example"
3
- filters:
4
- - gls_init
5
- ---
6
-
7
- ## Heading
8
-
9
- This filter adds formatting to heading text.
10
-
11
-
 
 
 
 
 
 
 
 
 
 
 
 
index.qmd CHANGED
@@ -1,7 +1,8 @@
1
  # Meet The Tornado {.unnumbered}
2
 
3
- <div id="loader_Initial" class="cl_Loader">
4
  </div>
 
5
  <div id="content_Load" style="display:none;">
6
  <!-- Your webpage content goes here
7
 
@@ -124,41 +125,38 @@ function hideLoaderAndShowContent() {
124
  content.style.display = "block";
125
  }
126
 
127
- function checkForPlotlyPlot() {
128
- console.log("everything is loaded")
129
 
130
- const plotElement = document.querySelector(".plotly-graph-div");
 
131
 
132
- if (plotElement) {
133
- console.log("Plotly plot is loaded.");
134
- clearInterval(intervalId);
135
- hideLoaderAndShowContent();
136
- } else {
137
- console.log("Plotly plot is not loaded.");
138
- }
139
- }
140
 
 
 
 
141
 
142
- function checkIfElementLoaded(elementId) {
143
- const element = document.getElementById(elementId);
144
- if (element) {
145
- console.log("Element with ID:", elementId, "is loaded.");
146
- } else {
147
- console.log("Element with ID:", elementId, "is not loaded.");
148
- }
149
- }
 
 
 
150
 
151
- function onPageLoad() {
152
- // Replace 'yourElementId' with the ID of the element you want to check
153
- checkIfElementLoaded("tornado_main");
154
  }
155
 
156
- // java script defined fcn to reeatedly execute a function
157
- const intervalId = setInterval(checkForPlotlyPlot, 1000); // Checks every 1000ms (1 second)
158
-
159
- // window.addEventListener("load", onPageLoad);
160
- // window.addEventListener("load", checkForPlotlyPlot);
161
-
162
 
163
  </script>
164
 
 
1
  # Meet The Tornado {.unnumbered}
2
 
3
+ <div id="loader_Initial" class="cl_Loader">
4
  </div>
5
+
6
  <div id="content_Load" style="display:none;">
7
  <!-- Your webpage content goes here
8
 
 
125
  content.style.display = "block";
126
  }
127
 
 
 
128
 
129
+ // This code defines a waitForScriptExecution function that sets up a MutationObserver to watch for changes in the div element with the class plotly-graph-div. When a change is detected, it logs a message, disconnects the observer, and hides the loader while showing the content.
130
+ function waitForScriptExecution() {
131
 
132
+ // the plotly figure has the id tornado_main
133
+ const tornadoMain = document.getElementById("tornado_main");
 
 
 
 
 
 
134
 
135
+ if (tornadoMain) {
136
+ // get the first element that is found by this class name
137
+ const targetDiv = tornadoMain.querySelector(".plotly-graph-div"); // Replace with the correct class name
138
 
139
+ if (targetDiv) {
140
+ const observer = new MutationObserver((mutationsList) => {
141
+ for (const mutation of mutationsList) {
142
+ if (mutation.type === "childList" && mutation.addedNodes.length > 0) {
143
+ console.log("Script has been executed and the div content has changed.");
144
+ observer.disconnect();
145
+ hideLoaderAndShowContent();
146
+ break;
147
+ }
148
+ }
149
+ });
150
 
151
+ observer.observe(targetDiv, { childList: true });
152
+ }
153
+ }
154
  }
155
 
156
+ // wait until the whole page has loaded once
157
+ window.addEventListener("load", function() {
158
+ waitForScriptExecution();
159
+ });
 
 
160
 
161
  </script>
162
 
trials.qmd CHANGED
@@ -2,37 +2,9 @@
2
 
3
  Thissince \gls{cnmc}
4
 
 
 
5
 
6
- <!-- ```{python}
7
- import plotly.io as pio
8
- pio.renderers.default = "plotly_mimetype+notebook_connected"
9
-
10
- # import plotly.io as pio
11
- import plotly.graph_objects as go
12
- import numpy as np
13
-
14
- # Helix equation
15
- t = np.linspace(0, 20, 100)
16
- x, y, z = np.cos(t), np.sin(t), t
17
-
18
- fig = go.Figure(data=[go.Scatter3d(
19
- x=x,
20
- y=y,
21
- z=z,
22
- mode='markers',
23
- marker=dict(
24
- size=12,
25
- color=z, # set color to an array/list of desired values
26
- colorscale='Viridis', # choose a colorscale
27
- opacity=0.8
28
- )
29
- )])
30
-
31
- # tight layout
32
- fig.update_layout(margin=dict(l=0, r=0, b=0, t=0))
33
- fig.show()
34
-
35
- ``` -->
36
 
37
  <div>
38
  <h1>Hello, World!</h1>
 
2
 
3
  Thissince \gls{cnmc}
4
 
5
+ <!-- src="" -->
6
+
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  <div>
10
  <h1>Hello, World!</h1>