-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
256 lines (237 loc) · 13.3 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
// ==UserScript==
// @name Hilti Profis Help
// @description Creates a mini window with helpful recommendations to mitigate anchor failure in Hilti Profis.
// @copyright 2023, remaa (https://struct.work)
// @license MIT
// @match https://profisengineering.hilti.com/design/*
// @grant none
// @supportURL https://github.com/rpakishore/hilti-profis-help
// @contributionURL https://github.com/rpakishore/hilti-profis-help/pulls
// @version 1.0.0
// @author remaa
// ==/UserScript==
(function() {
'use strict';
var targetButtonSelector = 'div.header-center-button-wrapper button.header-center-button';
// Create the mini window container
var container = document.createElement('div');
container.style.display = 'none';
container.style.position = 'fixed';
container.style.top = '50%';
container.style.left = '50%';
container.style.width = '50%';
container.style.transform = 'translate(-50%, -50%)';
container.style.backgroundColor = 'white';
container.style.border = '1px solid black';
container.style.padding = '10px';
container.style.zIndex = '9999';
// Add custom HTML code to the mini window
container.innerHTML = `
<h4>Help with Failures</h4>
<p style="font-size:10px">Hover over the recommendations for more information</p>
<style type="text/css">
.table-container {
width: 50%;
float: left;
}
</style>
<style type="text/css">
.tg {
border-collapse: collapse;
border-color: #9ABAD9;
border-spacing: 0;
}
.tg td {
background-color: #EBF5FF;
border-color: #9ABAD9;
border-style: solid;
border-width: 1px;
color: #444;
font-family: Arial, sans-serif;
font-size: 14px;
overflow: hidden;
padding: 10px 5px;
word-break: normal;
}
.tg th {
background-color: #409cff;
border-color: #9ABAD9;
border-style: solid;
border-width: 1px;
color: #fff;
font-family: Arial, sans-serif;
font-size: 14px;
font-weight: normal;
overflow: hidden;
padding: 10px 5px;
word-break: normal;
}
.tg .tg-mcqj {
border-color: inherit;
font-size: x-small;
font-weight: bold;
text-align: left;
vertical-align: top
}
.tg .tg-73oq {
border-color: inherit;
font-size: x-small;
text-align: left;
vertical-align: top
}
.tg .tg-0lax {
text-align: left;
vertical-align: top
}
</style>
<div class="table-container">
<h6>Tension Failure</h6>
<table class="tg">
<thead>
<tr>
<th class="tg-mcqj">Failure</th>
<th class="tg-mcqj">Remarks <br>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tg-73oq">Steel</td>
<td class="tg-73oq">
<ul>
<li title="Use higher strength steel to improve its ability to withstand tension forces.">Increase Steel Yield Strength</li>
<li title="Increase the cross-sectional area of the steel member to enhance its load-carrying capacity and resist tension failure.">Increase Steel Section Area</li>
<li title="Reduce the spacing between steel members to distribute the applied tension load more effectively and minimize the risk of steel failure.">Decrease Steel Spacing</li>
<li title="Provide sufficient and properly designed steel anchorage or connections to prevent steel failure at the interface between different structural elements.">Design Adequate Steel Anchorage/Connections</li>
<li title="Design the structure in a way that allows for load redistribution and stress transfer to adjacent members, reducing the risk of localized tension steel failure.">Incorporate Load Redistribution Mechanisms</li>
</ul>
</td>
</tr>
<tr>
<td class="tg-73oq">Breakout</td>
<td class="tg-73oq">
<ul>
<li title="Increasing the diameter of the anchor can help distribute the load over a larger area, reducing the potential for concrete breakout failure.">Increase Anchor Diameter</li>
<li title="The distance from the edge of the concrete member to the anchor can significantly impact its performance. Increasing the edge distance can improve the anchor's resistance to concrete breakout failure.">Increase Edge Distance</li>
<li title="Using a higher strength concrete can enhance its ability to resist breakout failure. Increasing the compressive strength of the concrete can help withstand higher tension forces.">Use Higher Concrete Strength</li>
<li title="Increasing the depth at which the anchor is embedded in the concrete can provide a larger surface area for load transfer, reducing the risk of breakout failure.">Increase Embedment Depth</li>
<li title="The distance between anchors also plays a role in preventing concrete breakout failure. Decreasing the spacing between anchors can distribute the load more evenly, reducing the likelihood of failure.">Decrease Anchor Spacing</li>
<li title="Incorporating steel reinforcement, such as rebar or anchor reinforcement, can enhance the overall strength and load-bearing capacity of the concrete and reduce the risk of breakout failure.">Incorporate Reinforcement</li>
</ul>
</td>
</tr>
<tr>
<td class="tg-73oq">Bond</td>
<td class="tg-73oq">
<ul>
<li title="Improve the bond strength between the reinforcing steel and the surrounding concrete by using appropriate surface preparation techniques, such as roughening the steel surface or using mechanical anchors.">Increase Bond Strength</li>
<li title="Increase the length of the steel reinforcement embedded in the concrete to enhance the bond strength and reduce the risk of bond failure.">Increase Embedment Length</li>
<li title="Provide a thicker concrete cover over the reinforcing steel to enhance the bond between the steel and the concrete.">Increase Concrete Cover</li>
<li title="Install transverse reinforcement, such as stirrups or ties, around the tensioned steel to enhance the bond strength and prevent bond failure.">Provide Transverse Reinforcement</li>
<li title="Use high-quality concrete with appropriate mix design, ensuring adequate strength and proper curing, which can contribute to better bond between the steel and the concrete.">Improve Concrete Quality</li>
<li title="Implement measures to minimize cracking in the concrete, such as proper joint design, crack control reinforcement, and appropriate construction techniques, to prevent bond failure.">Control Cracking</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<div class="table-container">
<h6>Shear Failure</h6>
<table class="tg">
<thead>
<tr>
<th class="tg-mcqj">Failure</th>
<th class="tg-mcqj">Remarks <br>
</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tg-73oq">Steel</td>
<td class="tg-73oq">
<ul>
<li title="Use higher strength shear steel to improve its ability to withstand shear forces and reduce the risk of shear steel failure.">Increase Shear Steel Strength</li>
<li title="Increase the cross-sectional area of the shear steel to enhance its load-carrying capacity and resistance to shear failure.">Increase Shear Steel Area</li>
<li title="Reduce the spacing between shear steel members to improve the shear resistance and prevent shear steel failure.">Decrease Shear Steel Spacing</li>
<li title="Choose a shear steel type or grade that is specifically designed to withstand high shear stresses and prevent shear steel failure.">Select Appropriate Shear Steel Type/Grade</li>
<li title="Utilize shear reinforcement, such as stirrups or bent bars, to enhance the shear resistance and prevent shear steel failure in critical regions.">Incorporate Shear Reinforcement</li>
</ul>
</td>
</tr>
<tr>
<td class="tg-73oq">Breakout</td>
<td class="tg-73oq">
<ul>
<li title="Increase the distance between the applied shear load and the concrete edge to reduce the risk of shear edge breakout failure.">Increase Edge Distance</li>
<li title="Use higher strength concrete to enhance its resistance to shear forces and minimize the likelihood of shear edge breakout failure.">Increase Concrete Strength</li>
<li title="Increase the depth at which the anchor or reinforcement is embedded in the concrete to improve the load transfer mechanism and mitigate shear edge breakout failure.">Increase Embedment Depth</li>
<li title="Incorporate shear reinforcement, such as stirrups or shear links, to enhance the capacity of the concrete to resist shear forces and prevent shear edge breakout failure.">Use Shear Reinforcement</li>
<li title="Include edge reinforcement, such as rebar or plate anchors, near the concrete edge to increase its resistance to shear and prevent shear edge breakout failure.">Provide Proper Edge Reinforcement</li>
<li title="Optimize the spacing and arrangement of anchors or fasteners near the concrete edge to distribute the shear load evenly and avoid concentrated stress points that could lead to shear edge breakout failure.">Adjust Anchor Layout</li>
<li title="Utilize specialized anchors or systems designed to address shear edge breakout failure, such as undercut anchors or expansion systems specifically engineered for high shear applications.">Consider Specialized Anchors or Systems</li>
</ul>
</td>
</tr>
<tr>
<td class="tg-73oq">Pryout</td>
<td class="tg-73oq">
<ul>
<li title="Increase the depth at which the anchor or reinforcement is embedded in the concrete to improve the load transfer mechanism and mitigate shear pryout failure.">Increase Embedment Depth</li>
<li title="Use higher strength concrete to enhance its resistance to shear forces and reduce the likelihood of shear pryout failure.">Increase Concrete Strength</li>
<li title="Increase the size and diameter of the anchor or reinforcement to provide a larger contact area and improve resistance against shear pryout failure.">Increase Anchor Size</li>
<li title="Increase the distance between the applied shear load and the concrete edge to reduce the risk of shear pryout failure.">Increase Edge Distance</li>
<li title="Incorporate shear reinforcement, such as stirrups, shear links, or shear reinforcement bars, to enhance the capacity of the concrete to resist shear forces and prevent shear pryout failure.">Use Shear Reinforcement</li>
<li title="Include edge reinforcement, such as additional reinforcing bars or plates, near the concrete edge to increase its resistance to shear and prevent shear pryout failure.">Provide Proper Edge Reinforcement</li>
<li title="Utilize specialized anchors or systems designed to address shear pryout failure, such as shear lugs, anchor plates, or post-installed shear connectors specifically engineered for resisting pryout forces.">Consider Specialized Anchors or Systems</li>
</ul>
</td>
</tr>
</tbody>
</table>
</div>
<button id="closeButton">Close</button>
`;
// Close the mini window and return to the original page
function closeMiniWindow() {
container.style.display = 'none';
}
// Open the mini window
function openMiniWindow() {
container.style.display = 'block';
}
// Observe changes in the DOM and execute the script once the desired element is present
var observer = new MutationObserver(function(mutationsList, observer) {
for (var i = 0; i < mutationsList.length; i++) {
var mutation = mutationsList[i];
if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
var targetButton = document.querySelector(targetButtonSelector);
if (targetButton) {
// Create the button
var button = document.createElement('button');
button.id = 'openMiniWindowButton';
button.type = 'button';
button.className = targetButton.className;
button.style.marginLeft = '10px'; // Adjust the margin as needed
button.textContent = 'Result Help - AE'; // Set the text content
// Append the button next to the original button
targetButton.parentNode.parentNode.insertBefore(button, targetButton.nextSibling);
// Add an event listener to the button
button.addEventListener('click', openMiniWindow);
// Add an event listener to the close button
var closeButton = container.querySelector('#closeButton');
if (closeButton) {
closeButton.addEventListener('click', closeMiniWindow);
}
// Append the mini window container to the document body
document.body.appendChild(container);
// Disconnect the observer once the button is added
observer.disconnect();
break;
}
}
}
});
// Start observing the DOM changes
observer.observe(document.body, { childList: true, subtree: true });
})();