### Project Setup and Installation (Bash)
Source: https://iqboatlifts.com/types-of-boat-liftsassessing-your-needs-and-factors/
Guides users through cloning the iqboatlifts-llms repository and installing project dependencies using pip. Requires Python 3.8+.
```bash
git clone https://github.com/example/iqboatlifts-llms.git
cd iqboatlifts-llms
```
```bash
pip install -r requirements.txt
```
--------------------------------
### Deployment Dockerfile
Source: https://iqboatlifts.com/types-of-boat-liftsassessing-your-needs-and-factors/
A sample Dockerfile provided for containerizing and deploying the iqboatlifts-llms application. It sets up the Python environment and installs dependencies.
```dockerfile
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "app.py"]
```
--------------------------------
### JavaScript API Client Example
Source: https://iqboatlifts.com/elite-cargo-lift/
An example of a JavaScript function to interact with a hypothetical API. It demonstrates making a POST request to an endpoint, sending JSON data, and handling the response.
```javascript
async function postDataToAPI(url, data) {
try {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY' // Example API key header
},
body: JSON.stringify(data)
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(`API error: ${response.status} - ${errorData.message}`);
}
const result = await response.json();
console.log('Success:', result);
return result;
} catch (error) {
console.error('Error posting data:', error);
throw error;
}
}
// Example usage:
// const apiUrl = 'https://api.example.com/process';
// const payload = { id: 123, value: 'test' };
// postDataToAPI(apiUrl, payload);
```
--------------------------------
### Lazy Load Initialization and Configuration
Source: https://iqboatlifts.com/faq/
Demonstrates the initialization of the LazyLoad library with various configuration options. It covers elements selection, data attributes for sources, CSS classes for loading states, and threshold settings for triggering load events. It also includes a MutationObserver to update the lazy loader when new content is added to the DOM.
```javascript
var lazyLoadOptions = [
{
elements_selector: ".rocket-lazyload",
data_src: "lazy-src",
data_srcset: "lazy-srcset",
data_sizes: "lazy-sizes",
class_loading: "lazyloading",
class_loaded: "lazyloaded",
threshold: 300,
callback_loaded: function(element) {
if (element.tagName === "IFRAME" && element.dataset.rocketLazyload === "fitvidscompatible") {
if (element.classList.contains("lazyloaded")) {
if (typeof window.jQuery !== "undefined") {
if (jQuery.fn.fitVids) {
jQuery(element).parent().fitVids();
}
}
}
}
}
}
];
window.addEventListener('LazyLoad::Initialized', function(e) {
var lazyLoadInstance = e.detail.instance;
if (window.MutationObserver) {
var observer = new MutationObserver(function(mutations) {
var image_count = 0;
var iframe_count = 0;
var rocketlazy_count = 0;
mutations.forEach(function(mutation) {
for (var i = 0; i < mutation.addedNodes.length; i++) {
if (typeof mutation.addedNodes[i].getElementsByTagName !== 'function') continue;
if (typeof mutation.addedNodes[i].getElementsByClassName !== 'function') continue;
var images = mutation.addedNodes[i].getElementsByTagName('img');
var is_image = mutation.addedNodes[i].tagName == "IMG";
var iframes = mutation.addedNodes[i].getElementsByTagName('iframe');
var is_iframe = mutation.addedNodes[i].tagName == "IFRAME";
var rocket_lazy = mutation.addedNodes[i].getElementsByClassName('rocket-lazyload');
image_count += images.length;
iframe_count += iframes.length;
rocketlazy_count += rocket_lazy.length;
if (is_image) image_count += 1;
if (is_iframe) iframe_count += 1;
}
});
if (image_count > 0 || iframe_count > 0 || rocketlazy_count > 0) {
lazyLoadInstance.update();
}
});
var b = document.getElementsByTagName("body")[0];
var config = { childList: true, subtree: true };
observer.observe(b, config);
}
}, false);
```
--------------------------------
### WordPress Internationalization Setup
Source: https://iqboatlifts.com/view/contact-us/
Sets locale data for WordPress internationalization, specifically defining the text direction for the 'en' locale.
```javascript
wp.i18n.setLocaleData( {
'text direction\u0004ltr': [
'ltr'
]
} );
```
--------------------------------
### Website Version and Settings
Source: https://iqboatlifts.com/the-rose-key-projects/
Provides the website's version number, static status, experimental feature flags, and core settings for page elements and editor preferences.
```json
{
"version": "3.29.2",
"is_static": false,
"experimentalFeatures": {
"e_font_icon_svg": true,
"additional_custom_breakpoints": true,
"e_local_google_fonts": true,
"theme_builder_v2": true,
"editor_v2": true,
"home_screen": true,
"cloud-library": true,
"e_opt_in_v4_page": true
},
"settings": {
"page": [],
"editorPreferences": []
}
}
```
--------------------------------
### RocketLazyLoadScripts Initialization
Source: https://iqboatlifts.com/all-about-boat-lifts/
Initializes the RocketLazyLoadScripts class for optimizing script loading. It handles preconnecting to resources, executing scripts with various attributes (like noModule, defer, async), and managing script loading states. It also includes logic for handling CSP issues and fallback mechanisms.
```JavaScript
class RocketLazyLoadScripts {
constructor() {
this.delayedScripts = {
normal: [],
defer: [],
async: []
};
this.trash = [];
this.lastBreath = 0;
this.fauxDomReadyFired = false;
this.persisted = false;
this.allJQueries = [];
this.CSPIssue = false;
}
async $(t) {
if (await this.G(), !0 !== t.noModule || !("noModule" in HTMLScriptElement.prototype)) return new Promise((e => {
let i;
function o() {
(i || t).setAttribute("data-rocket-status", "executed"), e()
}
try {
if (navigator.userAgent.includes("Firefox/") || "" === navigator.vendor || this.CSPIssue) i = document.createElement("script"), [...t.attributes].forEach((t => {
let e = t.nodeName;
"type" !== e && ("data-rocket-type" === e && (e = "type"), "data-rocket-src" === e && (e = "src"), i.setAttribute(e, t.nodeValue))
})), t.text && (i.text = t.text), t.nonce && (i.nonce = t.nonce), i.hasAttribute("src") ? (i.addEventListener("load", o, {isRocket: !0}), i.addEventListener("error", (() => {
i.setAttribute("data-rocket-status", "failed-network"), e()
}), {isRocket: !0}), setTimeout((() => {
i.isConnected || e()
}), 1)) : (i.text = t.text, o()), i.isWPRocket = !0, t.parentNode.replaceChild(i, t)
} else {
const i = t.getAttribute("data-rocket-type"),
s = t.getAttribute("data-rocket-src");
i ? (t.type = i, t.removeAttribute("data-rocket-type")) : t.removeAttribute("type"), t.addEventListener("load", o, {isRocket: !0}), t.addEventListener("error", (i => {
this.CSPIssue && i.target.src.startsWith("data:") ? (console.log("WPRocket: CSP fallback activated"), t.removeAttribute("src"), this.$(t).then(e)) : (t.setAttribute("data-rocket-status", "failed-network"), e())
}), {isRocket: !0}), s ? (t.fetchPriority = "high", t.removeAttribute("data-rocket-src"), t.src = s) : t.src = "data:text/javascript;base64," + window.btoa(unescape(encodeURIComponent(t.text))))
}
}
catch (i) {
t.setAttribute("data-rocket-status", "failed-transform"), e()
}
}));
t.setAttribute("data-rocket-status", "skipped")
}
async C(t) {
const e = t.shift();
return e ? (e.isConnected && await this.$(e), this.C(t)) : Promise.resolve()
}
O() {
this.N([...this.delayedScripts.normal, ...this.delayedScripts.defer, ...this.delayedScripts.async], "preload")
}
N(t, e) {
this.trash = this.trash || [];
let i = !0;
var o = document.createDocumentFragment();
t.forEach((t => {
const s = t.getAttribute && t.getAttribute("data-rocket-src") || t.src;
if (s && !s.startsWith("data:")) {
const n = document.createElement("link");
n.href = s, n.rel = e, "preconnect" !== e && (n.as = "script", n.fetchPriority = i ? "high" : "low"), t.getAttribute && "module" === t.getAttribute("data-rocket-type") && (n.crossOrigin = !0), t.crossOrigin && (n.crossOrigin = t.crossOrigin), t.integrity && (n.integrity = t.integrity), t.nonce && (n.nonce = t.nonce), o.appendChild(n), this.trash.push(n), i = !1
}
})), document.head.appendChild(o)
}
W() {
this.trash.forEach((t => t.remove()))
}
async T() {
try {
document.readyState = "interactive"
} catch (t) {}
this.fauxDomReadyFired = !0;
try {
await this.G(), document.dispatchEvent(new Event("rocket-readystatechange")),
await this.G(), document.rocketonreadystatechange && document.rocketonreadystatechange(),
await this.G(), document.dispatchEvent(new Event("rocket-DOMContentLoaded")),
await this.G(), window.dispatchEvent(new Event("rocket-DOMContentLoaded"))
} catch (t) {
console.error(t)
}
}
async A() {
try {
document.readyState = "complete"
} catch (t) {}
try {
await this.G(), document.dispatchEvent(new Event("rocket-readystatechange")),
await this.G(), document.rocketonreadystatechange && document.rocketonreadystatechange(),
await this.G(), window.dispatchEvent(new Event("rocket-load")),
await this.G(), window.rocketonload && window.rocketonload(),
await this.G(), this.allJQueries.forEach((t => t(window).trigger("rocket-jquery-load"))),
await this.G();
const t = new Event("rocket-pageshow");
t.persisted = this.persisted,
window.dispatchEvent(t),
await this.G(), window.rocketonpageshow && window.rocketonpageshow({persisted: this.persisted})
} catch (t) {
console.error(t)
}
}
async G() {
Date.now() - this.lastBreath > 45 && (await this.J(), this.lastBreath = Date.now())
}
async J() {
return document.hidden ? new Promise((t => setTimeout(t))) : new Promise((t => requestAnimationFrame(t)))
}
B(t, e) {
return e === document && "readystatechange" === t || (e === document && "DOMContentLoaded" === t || (e === window && "DOMContentLoaded" === t || (e === window && "load" === t || e === window && "pageshow" === t)))
}
static run() {
(new RocketLazyLoadScripts).T()
}
}
RocketLazyLoadScripts.run();
```
--------------------------------
### WordPress Internationalization Setup
Source: https://iqboatlifts.com/boat-lifts-mobile-al/
Sets the locale data for WordPress internationalization, specifically defining the text direction as left-to-right (LTR).
```javascript
wp.i18n.setLocaleData( {
'text direction\u0004ltr': [
'ltr'
]
} );
```
--------------------------------
### WordPress Internationalization Setup
Source: https://iqboatlifts.com/barnstable-ma/
Sets the locale data for WordPress's internationalization (i18n) library, specifying the text direction for the current locale.
```javascript
wp.i18n.setLocaleData( {
'text direction\u0004ltr': [
'ltr'
]
} );
```
--------------------------------
### JavaScript Link Preloading Logic
Source: https://iqboatlifts.com/boats-lifts/
This JavaScript module implements the core logic for preloading links based on user interaction (mouseover, mousedown, touchstart). It leverages browser compatibility checks and a defined configuration to intelligently prefetch resources, improving perceived page load times by adding `` elements to the document head.
```javascript
(function() { "use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e=function(){function i(e,t){for(var n=0;n` tags into the document head to prefetch resources. It includes throttling for hover events and checks for browser compatibility and data saver mode.
```javascript
var t=function(){function n(e,t){i(this,n),this.browser=e,this.config=t,this.options=this.browser.options,this.prefetched=new Set,this.eventTime=null,this.threshold=1111,this.numOnHover=0}return e(n,[{key:"init",value:function(){!this.browser.supportsLinkPrefetch()||this.browser.isDataSaverModeOn()||this.browser.isSlowConnection()||(this.regex={excludeUris:RegExp(this.config.excludeUris,"i"),images:RegExp(".("+this.config.imageExt+")$"),fileExt:RegExp(".("+this.config.fileExt+")$")},this._initListeners(this))}},{key:"_initListeners",value:function(e){-1i.config.rateThrottle)return;i.numOnHover++,i._addPrefetchLink(e)},this.config.onHoverDelay);t.addEventListener(n,function e(){t.removeEventListener(n,e,{passive:!0}),null!==r&&(clearTimeout(r),r=null)},{passive:!0})}},{key:"_addPrefetchLink",value:function(i){return this.prefetched.add(i.href),new Promise(function(e,t){var n=document.createElement("link");n.rel="prefetch",n.href=i.href,n.onload=e,n.onerror=t,document.head.appendChild(n)}).catch(function(){})}},{key:"_prepareUrl",value:function(e){if(null===e||"object"!==(void 0===e?"undefined":r(e))||!1 in e||-1===["http:","https:"].indexOf(e.protocol))return null;var t=e.href.substring(0,this.config.siteUrl.length),n=this._getPathname(e.href,t),i={original:e.href,protocol:e.protocol,origin:t,pathname:n,href:t+n};return this._isLinkOk(i)?i:null}},{key:"_getPathname",value:function(e,t){var n=t?e.substring(this.config.siteUrl.length):e;return n.startsWith("/")||(n="/"+n),this._shouldAddTrailingSlash(n)?n+"/":n}},{key:"_shouldAddTrailingSlash",value:function(e){return this.config.usesTrailingSlash&&!e.endsWith("/")&&!this.regex.fileExt.test(e)}},{key:"_isLinkOk",value:function(e){return null!==e||"object"===(void 0===e?"undefined":r(e))&&(!this.prefetched.has(e.href)&&e.origin===this.config.siteUrl&&-1===e.href.indexOf("?")&&-1===e.href.indexOf("#")&&!this.regex.excludeUris.test(e.href)&&!this.regex.images.test(e.href))}}],[{key:"run",value:function(){"undefined"!=typeof RocketPreloadLinksConfig&&new n(new RocketBrowserCompatibilityChecker({capture:!0,passive:!0}),RocketPreloadLinksConfig).init()}}]),n}();t.run();
```
--------------------------------
### WordPress Localization Setup
Source: https://iqboatlifts.com/specialty-lifts/
Sets the locale data for WordPress internationalization functions, specifying the text direction as left-to-right (ltr).
```javascript
wp.i18n.setLocaleData( {
'text direction\u0004ltr': [
'ltr'
]
} );
```