swfobject_modified.js
π Modified SWFObject v2.0 library for embedding Adobe Flash content in a cross-browser, cross-platform manner. It handles plugin detection, dynamic SWF insertion, Express Install fallback, and alternative HTML content when Flash is unavailable .
Browser & Plugin Detection
A centralized feature-detection module builds a ua object:
| Property | Description |
|---|---|
| w3cdom | W3C DOM support |
| pv | Flash Player version as [major, minor, release] |
| webkit | WebKit engine version or false |
| ie | Internet Explorer flag |
| win, mac | Operating system flags |
var ua = (function() {
// Detect DOM, Flash plugin via navigator.plugins or ActiveXObject
return { w3cdom, pv:playerVersion, webkit, ie, win, mac };
})();
DOM & Load Event Handling
onDomLoad: Firesmain()as soon as the DOM is ready in modern browsers, IE (via deferred script), WebKit (viareadyStatepolling), orDOMContentLoaded.addDomLoadEvent(fn)/addLoadEvent(fn): Queue functions for DOM ready or full page load.
addDomLoadEvent(main);
addLoadEvent(callDomLoadFunctions);
Main Embedding Logic
- Static Publishing: On DOM load or window load, loop through registered objects (
regObjArr). - Version Matching: If installed Flash β₯ required version, show SWF; else if Express Install conditions met, trigger installation UI; otherwise, swap in alternative content.
- Visibility Control: Uses dynamic CSS injection or inline style to hide/show elements pre- and post-insertion.
function main() {
regObjArr.forEach(reg => {
if (hasPlayerVersion(reg.swfVersion)) createSWF(...);
else displayAltContent(getElementById(reg.id));
});
}
Express Install & Alternative Content
- Express Install:
showExpressInstall(regObj)replaces original object with Adobeβs installer SWF and restores original content viaexpressInstallCallback(). - Alternative Content:
abstractAltContent(obj)clones nested HTML to display when Flash is missing or too old.
Dynamic SWF Creation
createSWF(attObj, parObj, id) handles three cases:
- IE/ActiveX: Uses
outerHTMLto build<object>and<param>tags. - Older WebKit: Falls back to
<embed>. - Standards Browsers: Creates
<object type="application/x-shockwave-flash">with nested<param>elements.
var o = createElement("object");
o.setAttribute("type", FLASH_MIME_TYPE);
Object.keys(attObj).forEach(k => o.setAttribute(k, attObj[k]));
Object.keys(parObj).forEach(n => createObjParam(o, n, parObj[n]));
el.parentNode.replaceChild(o, el);
Public API
| Method | Description |
|---|---|
| registerObject(id, version, xi) | Static publishing: hide element and queue for Flash version check. |
| getObjectById(id) | Retrieve embedded SWF or <object> element for scripting. |
| embedSWF(...) | Dynamic publishing: insert SWF at replaceElemIdStr with width, height, flashvars. |
| getFlashPlayerVersion() | Returns { major, minor, release }. |
| hasFlashPlayerVersion(ver) | Alias for hasPlayerVersion(rv). |
| createSWF(att, par, id) | Expose dynamic SWF creation outside the module. |
| createCSS(sel, decl) | Inject CSS rules at runtime. |
| addDomLoadEvent(fn) | Queue function for DOM ready. |
| addLoadEvent(fn) | Queue function for full page load. |
| getQueryParamValue(param) | Read URL query or hash parameter. |
| expressInstallCallback() | Restore original content after Express Install completes. |
bootstrap-validation.js
Built-in HTML5 form validation support for Bootstrap-style forms. It prevents invalid submissions and toggles the was-validated class on each form .
document.addEventListener('DOMContentLoaded', () => {
const forms = document.querySelectorAll('form');
Array.from(forms).forEach(form => {
form.addEventListener('submit', event => {
if (!form.checkValidity()) {
event.preventDefault();
event.stopPropagation();
}
form.classList.add('was-validated');
}, false);
});
});
ddsmoothmenu.js
Dynamic Drive Smooth Navigational Menu offering multi-level, animated drop-down menus with optional shadows and custom themes .
- Arrow Images:
arrowimages.down&arrowimages.right. - Transition:
transition.overtimeandtransition.outtime. - Shadow:
shadow.enable,shadow.offsetx/y. - Show/Hide Delay:
showhidedelay.showdelay&hidedelay. - Initialization:
ddsmoothmenu.init({ mainmenuid, orientation, contentsource, customtheme }).
ddsmoothmenu.init({
mainmenuid: "menu",
orientation: "h",
showhidedelay: { showdelay: 200, hidedelay: 200 }
});
function.js
General UI utilities and interactive behaviors powered by jQuery :
- π Back-to-Top:
.btn-backTopscrolls the page to top. - π‘ reCAPTCHA Scaling: Auto-scales
.g-recaptchaif its containerβs width < 302px. - β¨ Scroll Animations: Toggles
.animatableβ.animatedwhen elements enter viewport. - π± Responsive Class Toggle: Adjust
.fa-track-shipmentclasses on window resize. - π Accordion:
.accordion-toggleslide-toggles.mw-collapse. - π Contact Icon:
.contact_iconslide-toggles.abc. - π Logo Carousel: Initializes Slick slider on
.customer-logos.
$('.btn-backTop').click(() => {
$('html,body').animate({ scrollTop: 0 }, 800);
return false;
});
$('.customer-logos').slick({ slidesToShow: 7, autoplay: true, responsive: [...] });
nav-scroll.js
π½ Hide or reveal an element (e.g., header) on vertical scroll :
let prevScrollpos = window.pageYOffset;
window.onscroll = () => {
let currentScrollPos = window.pageYOffset;
const el = document.getElementById("hideOnScroll");
if (prevScrollpos < currentScrollPos) el.classList.add("topHide");
else el.classList.remove("topHide");
prevScrollpos = currentScrollPos;
};
sprintf.js
A JavaScript sprintf emulation of Cβs printf formatting, supporting flags, width, precision, and types (s, d, f, x, etc.) .
sprintf("%04d", 25); // "0025"
sprintf("[%'#10s]", "hi"); // "[########hi]"
Key internal functions:
pad(str, len, chr, leftJustify)justify(value, prefix, leftJustify, minWidth, zeroPad)formatBaseX(value, base, prefix, leftJustify, minWidth, precision, zeroPad)createObjParam(el, name, value)
base64.js
π¦ Base64 encoder/decoder by Fred Palmer, with UTF-8 support :
Base64.encode("Hello"); // "SGVsbG8="
Base64.decode("SGVsbG8="); // "Hello"
Implements:
StringBufferfor efficient string concatenation.Utf8EncodeEnumeratorandBase64DecodeEnumeratorfor byte-level processing.
jsLabel2PDF.js
π HTML-to-PDF label generator using a custom JavaScript PDF stream writer and Base64 embedding .
$.CreateTemplate(units, paperWidth, paperHeight, ...): Set up page and label dimensions.$.CreateLabel(): Prepare a new label.$.AddText(x, y, str, fontSize): Queue text at coordinates.$.DrawPDF(): Assemble PDF objects and prompt download as Data URI.
$.CreateTemplate("inches", 4, 6, 0, 0, 4, 6, 1, 6, 0.4, 0);
$.AddText(0.8, 0.8, "Test Labels", 12);
$.DrawPDF();
mediaplayer/license.txt
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 license for JW Player assets .
mediaplayer/readme.html
π Quickstart guide for JW Player 5 embedding. Includes:
- Folder structure for
jwplayer/. - Example HTML embed snippet:
<div id="mediaplayer">JW Player goes here</div>
<script src="jwplayer.js"></script>
<script>
jwplayer("mediaplayer").setup({
flashplayer: "player.swf",
file: "video.mp4",
image: "preview.jpg"
});
</script>