diff --git a/mobify-custom.js.example b/mobify-custom.js.example index 752d83d9..2f16135d 100644 --- a/mobify-custom.js.example +++ b/mobify-custom.js.example @@ -1,21 +1,15 @@ require(["capture", "resizeImages"], function(Capture, ResizeImages) { var Mobify = window.Mobify = window.Mobify || {}; + + // DECLARE LIBRARIES ATTACHED TO MOBIFY OBJECT HERE + Mobify.Capture = Capture; + Mobify.ResizeImages = ResizeImages; - // === HACKS TO ENSURE NEW CODE WORKING WITH v6 TAG === // - - if (Mobify.api != "2.0.0") { // same as if (capturing) - // legacy need for v6 tags - Mobify.api = "2.0.0"; - - // Remove the bootstrap and tag scripts - var scripts = document.getElementsByTagName("script"); - var preview = scripts[1]; - preview.parentNode.removeChild(preview); - var tag = scripts[1]; - tag.parentNode.removeChild(tag); - - // === END HACKS ====// - + // OPTIONAL: Also add main executable logic to compile library + main + // instead of having seperate main.js file + /* + var capturing = window.capturing || false; + if (capturing) { // Grab reference to a newly created document var capture = new Capture(); var capturedDoc = capture.capturedDoc; @@ -24,7 +18,7 @@ require(["capture", "resizeImages"], function(Capture, ResizeImages) { ResizeImages.resize(capturedDoc, 320); // Render source DOM to document capture.renderCapturedDoc(); - } + }*/ }, undefined, true); -// relPath, forceSync \ No newline at end of file +// relPath, forceSync diff --git a/mobify-custom.js.example.v6 b/mobify-custom.js.example.v6 new file mode 100644 index 00000000..752d83d9 --- /dev/null +++ b/mobify-custom.js.example.v6 @@ -0,0 +1,30 @@ +require(["capture", "resizeImages"], function(Capture, ResizeImages) { + var Mobify = window.Mobify = window.Mobify || {}; + + // === HACKS TO ENSURE NEW CODE WORKING WITH v6 TAG === // + + if (Mobify.api != "2.0.0") { // same as if (capturing) + // legacy need for v6 tags + Mobify.api = "2.0.0"; + + // Remove the bootstrap and tag scripts + var scripts = document.getElementsByTagName("script"); + var preview = scripts[1]; + preview.parentNode.removeChild(preview); + var tag = scripts[1]; + tag.parentNode.removeChild(tag); + + // === END HACKS ====// + + // Grab reference to a newly created document + var capture = new Capture(); + var capturedDoc = capture.capturedDoc; + + // Resize images using Mobify Image Resizer + ResizeImages.resize(capturedDoc, 320); + // Render source DOM to document + capture.renderCapturedDoc(); + } + +}, undefined, true); +// relPath, forceSync \ No newline at end of file