From a6c04d565a93f524100fadde138519cff69f3fd5 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Sun, 11 Jan 2026 09:11:07 -0500 Subject: [PATCH 001/129] Add google_site_verification support for namespaces - Add google_site_verification column to rb_namespace table - Add settings form field in Stand-alone Mode Settings - Render meta tag on root path when set - Update CLAUDE.md with Alembic migration workflow - Fix development.ini alembic paths --- CLAUDE.md | 10 ++++++++ development.ini | 4 ++-- remarkbox/models/namespace.py | 2 ++ ...add_google_site_verification_column_to_.py | 24 +++++++++++++++++++ remarkbox/templates/base.j2 | 3 +++ remarkbox/templates/namespace-settings.j2 | 6 +++++ .../views/authenticated/authenticated.py | 14 +++++++++++ 7 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 remarkbox/scripts/alembic/versions/d1213344ca99_add_google_site_verification_column_to_.py diff --git a/CLAUDE.md b/CLAUDE.md index 802d45e..36dea23 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -24,3 +24,13 @@ Commit message here. - Any fake corporate entities as co-authors **Only attribute real humans** as co-authors when collaborating. + +## Database Migrations (Alembic) + +When adding new columns or modifying the database schema: + +1. **Backup SQLite first**: `cp data/remarkbox.sqlite data/remarkbox.sqlite.bak` +2. **Add the column to the model** in `remarkbox/models/` +3. **Generate migration**: `alembic -c development.ini revision --autogenerate -m "description"` +4. **Clean up migration**: Remove extra autogenerated changes, keep only the new field +5. **Run migration**: `alembic -c development.ini upgrade head` diff --git a/development.ini b/development.ini index 3da0494..975c8cb 100644 --- a/development.ini +++ b/development.ini @@ -2,8 +2,8 @@ # http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html [alembic] -script_location = remarkbox:scripts/alembic -sqlalchemy.url = sqlite:///%(here)s/remarkbox.sqlite +script_location = remarkbox/scripts/alembic +sqlalchemy.url = sqlite:///%(here)s/data/remarkbox.sqlite [app:main] use = egg:remarkbox diff --git a/remarkbox/models/namespace.py b/remarkbox/models/namespace.py index 5c711d7..63fe580 100644 --- a/remarkbox/models/namespace.py +++ b/remarkbox/models/namespace.py @@ -86,6 +86,8 @@ class Namespace(RBase, Base): owner_request_timestamp = Column(BigInteger, nullable=True) # optional google analytics id for stand alone mode. google_analytics_id = Column(Unicode(18), nullable=True) + # optional google site verification code for stand alone mode. + google_site_verification = Column(Unicode(128), nullable=True) # allow anyone to edit the root node. (not implemented yet) wiki = Column(Boolean, default=False) # by default we show all nodes but a Namespace can change this behavior. diff --git a/remarkbox/scripts/alembic/versions/d1213344ca99_add_google_site_verification_column_to_.py b/remarkbox/scripts/alembic/versions/d1213344ca99_add_google_site_verification_column_to_.py new file mode 100644 index 0000000..de4cab4 --- /dev/null +++ b/remarkbox/scripts/alembic/versions/d1213344ca99_add_google_site_verification_column_to_.py @@ -0,0 +1,24 @@ +"""add google_site_verification column to namespace + +Revision ID: d1213344ca99 +Revises: 108519de76ac +Create Date: 2026-01-11 09:06:53.272415 + +""" + +# revision identifiers, used by Alembic. +revision = 'd1213344ca99' +down_revision = '108519de76ac' +branch_labels = None +depends_on = None + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + op.add_column('rb_namespace', sa.Column('google_site_verification', sa.Unicode(length=128), nullable=True)) + + +def downgrade(): + op.drop_column('rb_namespace', 'google_site_verification') diff --git a/remarkbox/templates/base.j2 b/remarkbox/templates/base.j2 index f0c7d78..5769f0c 100644 --- a/remarkbox/templates/base.j2 +++ b/remarkbox/templates/base.j2 @@ -9,6 +9,9 @@ +{% if request.path == '/' and request.namespace.google_site_verification %} + +{% endif %} {% include 'snippets/stylesheet-includes.j2' %} diff --git a/remarkbox/templates/namespace-settings.j2 b/remarkbox/templates/namespace-settings.j2 index c4e1234..2773df4 100644 --- a/remarkbox/templates/namespace-settings.j2 +++ b/remarkbox/templates/namespace-settings.j2 @@ -125,6 +125,12 @@ You can host your own CSS file and link it here.

+ + + +
+
+ {% set submit_button_classes = 'button-right green-button' %} {% set submit_button_value = 'save changes' %} {% include 'snippets/submit.j2' %} diff --git a/remarkbox/views/authenticated/authenticated.py b/remarkbox/views/authenticated/authenticated.py index 1685612..247f12f 100644 --- a/remarkbox/views/authenticated/authenticated.py +++ b/remarkbox/views/authenticated/authenticated.py @@ -58,6 +58,9 @@ def namespace_settings(request): google_analytics_id = p.get( "google-analytics-id", request.namespace.google_analytics_id ) + google_site_verification = p.get( + "google-site-verification", request.namespace.google_site_verification + ) hide_unless_approved_checkbox = p.get("hide-unless-approved-checkbox", "off") allow_anonymous_checkbox = p.get("allow-anonymous-checkbox", "off") @@ -137,6 +140,17 @@ def namespace_settings(request): ) ) + if google_site_verification != request.namespace.google_site_verification and ( + google_site_verification or request.namespace.google_site_verification + ): + request.namespace.google_site_verification = google_site_verification + request.session.flash( + ( + "Success, you changed the Google Site Verification code for stand alone mode.", + "success", + ) + ) + if hide_unless_approved != request.namespace.hide_unless_approved: request.namespace.hide_unless_approved = hide_unless_approved request.session.flash( From 06ba1067954a3f107f15f1ad8f2059ee14fa32e2 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Sun, 11 Jan 2026 09:28:59 -0500 Subject: [PATCH 002/129] Fix sitemap lastmod date format for Google --- remarkbox/templates/sitemap.xml.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remarkbox/templates/sitemap.xml.j2 b/remarkbox/templates/sitemap.xml.j2 index 99dfe39..4894900 100644 --- a/remarkbox/templates/sitemap.xml.j2 +++ b/remarkbox/templates/sitemap.xml.j2 @@ -5,7 +5,7 @@ {{ request.host_url }}{{ node.path }} weekly 0.8 - {{ node.changed_datetime.isoformat() }} + {{ node.changed_datetime.strftime('%Y-%m-%d') }} {% endfor %} From a49446cfefb807b08ee3bceb3cb04c497967998a Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Wed, 21 Jan 2026 12:36:31 -0500 Subject: [PATCH 003/129] Add parallel test execution with pytest-xdist Implements per-worker database isolation for parallel test runs: - Add pytest-xdist and pytest-cov to test dependencies - Configure Makefile to run tests with -n auto flag - Update test.ini to use environment variable for database path - Create conftest.py with per-worker database isolation - Enable SQLite WAL mode for better concurrency - Auto-cleanup test databases after completion Expected performance improvement similar to make_post_sell (~16x speedup). Co-Authored-By: Claude Sonnet 4.5 --- Makefile | 5 +-- remarkbox/tests/conftest.py | 77 +++++++++++++++++++++++++++++++++++++ requirements-test.txt | 2 + test.ini | 4 +- 4 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 remarkbox/tests/conftest.py diff --git a/Makefile b/Makefile index 5708859..bd6a875 100644 --- a/Makefile +++ b/Makefile @@ -113,11 +113,10 @@ activate: @echo "To activate the virtual environment, run:" @echo " source $(VENV_DIR)/bin/activate" -# Run the test suite (installs test dependencies if needed) # Run the test suite (installs test dependencies if needed) test: install-source-dev-and-test - @echo "Running tests..." - $(VENV_DIR)/bin/py.test + @echo "Running tests in parallel..." + $(VENV_DIR)/bin/py.test -n auto # Start a simple HTTP server (for serving static files like index.html) http: venv diff --git a/remarkbox/tests/conftest.py b/remarkbox/tests/conftest.py new file mode 100644 index 0000000..1c6e372 --- /dev/null +++ b/remarkbox/tests/conftest.py @@ -0,0 +1,77 @@ +""" +Pytest configuration for parallel test execution. + +This module configures pytest-xdist to use isolated databases per worker +to avoid SQLite locking issues during parallel test runs. +""" +import os +import pytest + + +def pytest_configure(config): + """ + Configure test database isolation for parallel execution. + + Each pytest-xdist worker gets its own database file to prevent + SQLite locking conflicts. WAL mode is enabled for better concurrency. + """ + # Get worker ID (e.g., "gw0", "gw1", etc.) for pytest-xdist + worker_id = os.environ.get("PYTEST_XDIST_WORKER", "master") + + # Set unique database path for this worker + test_db_path = f"test-remarkbox_{worker_id}.sqlite" + os.environ["TEST_DATABASE_PATH"] = test_db_path + + # Store for cleanup + config.test_db_path = test_db_path + + +def pytest_unconfigure(config): + """Clean up test database after all tests complete.""" + if hasattr(config, "test_db_path"): + db_path = config.test_db_path + if os.path.exists(db_path): + try: + os.remove(db_path) + except Exception as e: + print(f"Warning: Could not remove test database {db_path}: {e}") + + +@pytest.fixture(scope="session") +def db_engine(request): + """ + Create a SQLAlchemy engine with WAL mode enabled for concurrency. + + WAL (Write-Ahead Logging) mode allows multiple readers while a writer + is active, improving parallel test performance. + """ + from sqlalchemy import create_engine, event + + # Use worker-specific database + worker_id = os.environ.get("PYTEST_XDIST_WORKER", "master") + db_path = f"test-remarkbox_{worker_id}.sqlite" + db_url = f"sqlite:///{db_path}" + + engine = create_engine( + db_url, + echo=False, + # Important: Use NullPool to avoid connection sharing issues + poolclass=__import__("sqlalchemy.pool", fromlist=["NullPool"]).NullPool, + ) + + # Enable WAL mode for better concurrency + @event.listens_for(engine, "connect") + def set_sqlite_pragma(dbapi_conn, connection_record): + cursor = dbapi_conn.cursor() + # Enable WAL mode for concurrent access + cursor.execute("PRAGMA journal_mode=WAL") + # Increase cache size for better performance + cursor.execute("PRAGMA cache_size=-64000") # 64MB + # Enable foreign keys + cursor.execute("PRAGMA foreign_keys=ON") + cursor.close() + + yield engine + + # Cleanup + engine.dispose() diff --git a/requirements-test.txt b/requirements-test.txt index 0a36b85..c9b788e 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,5 +1,7 @@ # testing. pytest +pytest-cov +pytest-xdist # Parallel test execution nose mock webtest diff --git a/test.ini b/test.ini index bc805bf..a3781db 100644 --- a/test.ini +++ b/test.ini @@ -2,12 +2,12 @@ [alembic] script_location = remarkbox:scripts/alembic -sqlalchemy.url = sqlite:///%(here)s/test-remarkbox.sqlite +sqlalchemy.url = sqlite:///%(here)s/${TEST_DATABASE_PATH:-test-remarkbox.sqlite} [app:main] use = egg:remarkbox -sqlalchemy.url = sqlite:///%(here)s/test-remarkbox.sqlite +sqlalchemy.url = sqlite:///%(here)s/${TEST_DATABASE_PATH:-test-remarkbox.sqlite} #sqlalchemy.url = postgres://localhost/remarkbox_test ### From 2f8e676f780504a0909f19c1d138a35fcc3ca0c0 Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Thu, 22 Jan 2026 12:48:02 -0500 Subject: [PATCH 004/129] Add template syntax validation tests Validates all Jinja2 templates can be parsed without syntax errors. Catches issues like mismatched {% if %}/{% endif %} blocks before deployment. --- remarkbox/tests/test_templates.py | 91 +++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 remarkbox/tests/test_templates.py diff --git a/remarkbox/tests/test_templates.py b/remarkbox/tests/test_templates.py new file mode 100644 index 0000000..93cfc08 --- /dev/null +++ b/remarkbox/tests/test_templates.py @@ -0,0 +1,91 @@ +""" +Template validation tests. + +These tests ensure all Jinja2 templates have valid syntax and can be compiled. +This catches errors like mismatched {% if %}/{% endif %} blocks before deployment. +""" +import os +import unittest +from pathlib import Path + +from jinja2 import Environment, FileSystemLoader, TemplateSyntaxError + + +class TestTemplateValidation(unittest.TestCase): + """Test that all Jinja2 templates have valid syntax.""" + + @classmethod + def setUpClass(cls): + """Set up Jinja2 environment for template testing.""" + # Find templates directory + tests_dir = Path(__file__).parent + templates_dir = tests_dir.parent / "templates" + cls.templates_dir = templates_dir + + # Create Jinja2 environment matching the app configuration + cls.env = Environment( + loader=FileSystemLoader(str(templates_dir)), + # Don't fail on undefined variables during syntax check + autoescape=True, + ) + + def test_all_templates_have_valid_syntax(self): + """ + Verify all .j2 templates can be parsed without syntax errors. + + This catches issues like: + - Mismatched {% if %}/{% endif %} blocks + - Unclosed {% block %} tags + - Invalid Jinja2 syntax + """ + errors = [] + + # Walk through all templates + for root, dirs, files in os.walk(self.templates_dir): + for filename in files: + if filename.endswith(".j2"): + # Get relative path for Jinja2 loader + full_path = Path(root) / filename + rel_path = full_path.relative_to(self.templates_dir) + template_name = str(rel_path) + + try: + # Attempt to parse the template + self.env.get_template(template_name) + except TemplateSyntaxError as e: + errors.append( + f"{template_name}:{e.lineno}: {e.message}" + ) + + if errors: + self.fail( + f"Template syntax errors found:\n" + "\n".join(errors) + ) + + def test_base_template_exists(self): + """Verify the base template exists and is valid.""" + try: + template = self.env.get_template("base.j2") + self.assertIsNotNone(template) + except TemplateSyntaxError as e: + self.fail(f"base.j2 has syntax error at line {e.lineno}: {e.message}") + + def test_home_template_exists(self): + """Verify home.j2 template exists and is valid.""" + try: + template = self.env.get_template("home.j2") + self.assertIsNotNone(template) + except TemplateSyntaxError as e: + self.fail(f"home.j2 has syntax error at line {e.lineno}: {e.message}") + + def test_show_node_template_exists(self): + """Verify show-node.j2 template exists and is valid.""" + try: + template = self.env.get_template("show-node.j2") + self.assertIsNotNone(template) + except TemplateSyntaxError as e: + self.fail(f"show-node.j2 has syntax error at line {e.lineno}: {e.message}") + + +if __name__ == "__main__": + unittest.main() From 67648f06f948f70da24c71f1535f8e5e457de5cb Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Sat, 24 Jan 2026 08:04:37 -0500 Subject: [PATCH 005/129] Persist preview visibility state in localStorage --- remarkbox/static/js/custom.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/remarkbox/static/js/custom.js b/remarkbox/static/js/custom.js index cf83576..92c5df1 100644 --- a/remarkbox/static/js/custom.js +++ b/remarkbox/static/js/custom.js @@ -90,7 +90,7 @@ function toggle(target, button, off_text, on_text) { } } -// Animate
close for preview-details elements. +// Animate
close for preview-details elements and persist state in localStorage. if (typeof document.addEventListener === 'function') { document.addEventListener('click', function(e) { var summary = e.target.closest('.preview-toggle'); @@ -100,10 +100,13 @@ if (typeof document.addEventListener === 'function') { if (details.open && !details.classList.contains('closing')) { e.preventDefault(); details.classList.add('closing'); + localStorage.setItem('remarkbox-preview-hidden', 'true'); setTimeout(function() { details.open = false; details.classList.remove('closing'); }, 800); + } else if (!details.open) { + localStorage.removeItem('remarkbox-preview-hidden'); } }, true); } @@ -118,6 +121,13 @@ function autoGrow(el) { // Initialize on DOM ready document.addEventListener('DOMContentLoaded', function() { + // Restore preview state from localStorage + if (localStorage.getItem('remarkbox-preview-hidden') === 'true') { + document.querySelectorAll('.preview-details').forEach(function(details) { + details.open = false; + }); + } + // Auto-grow textareas on input document.querySelectorAll('.common-textarea').forEach(function(textarea) { textarea.addEventListener('input', function() { From 8971a46659aa34a12ff3c23715a402e4e188f8c0 Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Sat, 24 Jan 2026 08:35:35 -0500 Subject: [PATCH 006/129] Hide preview toggle when JavaScript is disabled --- remarkbox/templates/snippets/forms.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/remarkbox/templates/snippets/forms.j2 b/remarkbox/templates/snippets/forms.j2 index 27b717d..4be6014 100644 --- a/remarkbox/templates/snippets/forms.j2 +++ b/remarkbox/templates/snippets/forms.j2 @@ -26,7 +26,7 @@ {% set submit_button_value = 'save message' %} {% include 'submit.j2' %} -
+
hide preview ▲show preview ▼
From 32b1eae8400afd2523303574a6e66b671098b1d9 Mon Sep 17 00:00:00 2001 From: "russell@unturf.com" Date: Wed, 28 Jan 2026 07:50:45 -0500 Subject: [PATCH 007/129] Fix getElementById('') warning when no hash fragment present --- .../js/iframe-resizer/iframeResizer.contentWindow.js | 2 +- .../iframe-resizer/iframeResizer.contentWindow.min.js | 11 +---------- .../iframeResizer.contentWindow.min.js.map | 1 + remarkbox/static/js/iframe-resizer/iframeResizer.js | 2 +- .../static/js/iframe-resizer/iframeResizer.min.js | 10 +--------- .../static/js/iframe-resizer/iframeResizer.min.js.map | 1 + 6 files changed, 6 insertions(+), 21 deletions(-) create mode 100644 remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.min.js.map create mode 100644 remarkbox/static/js/iframe-resizer/iframeResizer.min.js.map diff --git a/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.js b/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.js index 4b6c789..9d200ae 100644 --- a/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.js +++ b/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.js @@ -415,7 +415,7 @@ var hash = location.split('#')[1] || location, //Remove # if present hashData = decodeURIComponent(hash), - target = document.getElementById(hashData) || document.getElementsByName(hashData)[0]; + target = hashData ? (document.getElementById(hashData) || document.getElementsByName(hashData)[0]) : null; if (undefined !== target){ jumpToTarget(target); diff --git a/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.min.js b/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.min.js index 2b6760e..7071339 100644 --- a/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.min.js +++ b/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.min.js @@ -1,10 +1 @@ -/*! iFrame Resizer (iframeSizer.contentWindow.min.js) - v3.5.14 - 2017-03-30 - * Desc: Include this file in any page being loaded into an iframe - * to force the iframe to resize to the content size. - * Requires: iframeResizer.min.js on host page. - * Copyright: (c) 2017 David J. Bradshaw - dave@bradshaw.net - * License: MIT - */ - -!function(a){"use strict";function b(a,b,c){"addEventListener"in window?a.addEventListener(b,c,!1):"attachEvent"in window&&a.attachEvent("on"+b,c)}function c(a,b,c){"removeEventListener"in window?a.removeEventListener(b,c,!1):"detachEvent"in window&&a.detachEvent("on"+b,c)}function d(a){return a.charAt(0).toUpperCase()+a.slice(1)}function e(a){var b,c,d,e=null,f=0,g=function(){f=Ha(),e=null,d=a.apply(b,c),e||(b=c=null)};return function(){var h=Ha();f||(f=h);var i=xa-(h-f);return b=this,c=arguments,0>=i||i>xa?(e&&(clearTimeout(e),e=null),f=h,d=a.apply(b,c),e||(b=c=null)):e||(e=setTimeout(g,i)),d}}function f(a){return ma+"["+oa+"] "+a}function g(a){la&&"object"==typeof window.console&&console.log(f(a))}function h(a){"object"==typeof window.console&&console.warn(f(a))}function i(){j(),g("Initialising iFrame ("+location.href+")"),k(),n(),m("background",W),m("padding",$),A(),s(),t(),o(),C(),u(),ia=B(),N("init","Init message from host page"),Da()}function j(){function b(a){return"true"===a?!0:!1}var c=ha.substr(na).split(":");oa=c[0],X=a!==c[1]?Number(c[1]):X,_=a!==c[2]?b(c[2]):_,la=a!==c[3]?b(c[3]):la,ja=a!==c[4]?Number(c[4]):ja,U=a!==c[6]?b(c[6]):U,Y=c[7],fa=a!==c[8]?c[8]:fa,W=c[9],$=c[10],ua=a!==c[11]?Number(c[11]):ua,ia.enable=a!==c[12]?b(c[12]):!1,qa=a!==c[13]?c[13]:qa,Aa=a!==c[14]?c[14]:Aa}function k(){function a(){var a=window.iFrameResizer;g("Reading data from page: "+JSON.stringify(a)),Ca="messageCallback"in a?a.messageCallback:Ca,Da="readyCallback"in a?a.readyCallback:Da,ta="targetOrigin"in a?a.targetOrigin:ta,fa="heightCalculationMethod"in a?a.heightCalculationMethod:fa,Aa="widthCalculationMethod"in a?a.widthCalculationMethod:Aa}function b(a,b){return"function"==typeof a&&(g("Setup custom "+b+"CalcMethod"),Fa[b]=a,a="custom"),a}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(a(),fa=b(fa,"height"),Aa=b(Aa,"width")),g("TargetOrigin for parent set to: "+ta)}function l(a,b){return-1!==b.indexOf("-")&&(h("Negative CSS value ignored for "+a),b=""),b}function m(b,c){a!==c&&""!==c&&"null"!==c&&(document.body.style[b]=c,g("Body "+b+' set to "'+c+'"'))}function n(){a===Y&&(Y=X+"px"),m("margin",l("margin",Y))}function o(){document.documentElement.style.height="",document.body.style.height="",g('HTML & body height set to "auto"')}function p(a){var e={add:function(c){function d(){N(a.eventName,a.eventType)}Ga[c]=d,b(window,c,d)},remove:function(a){var b=Ga[a];delete Ga[a],c(window,a,b)}};a.eventNames&&Array.prototype.map?(a.eventName=a.eventNames[0],a.eventNames.map(e[a.method])):e[a.method](a.eventName),g(d(a.method)+" event listener: "+a.eventType)}function q(a){p({method:a,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),p({method:a,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),p({method:a,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),p({method:a,eventType:"Input",eventName:"input"}),p({method:a,eventType:"Mouse Up",eventName:"mouseup"}),p({method:a,eventType:"Mouse Down",eventName:"mousedown"}),p({method:a,eventType:"Orientation Change",eventName:"orientationchange"}),p({method:a,eventType:"Print",eventName:["afterprint","beforeprint"]}),p({method:a,eventType:"Ready State Change",eventName:"readystatechange"}),p({method:a,eventType:"Touch Start",eventName:"touchstart"}),p({method:a,eventType:"Touch End",eventName:"touchend"}),p({method:a,eventType:"Touch Cancel",eventName:"touchcancel"}),p({method:a,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),p({method:a,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),p({method:a,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),"child"===qa&&p({method:a,eventType:"IFrame Resized",eventName:"resize"})}function r(a,b,c,d){return b!==a&&(a in c||(h(a+" is not a valid option for "+d+"CalculationMethod."),a=b),g(d+' calculation method set to "'+a+'"')),a}function s(){fa=r(fa,ea,Ia,"height")}function t(){Aa=r(Aa,za,Ja,"width")}function u(){!0===U?(q("add"),F()):g("Auto Resize disabled")}function v(){g("Disable outgoing messages"),ra=!1}function w(){g("Remove event listener: Message"),c(window,"message",S)}function x(){null!==Z&&Z.disconnect()}function y(){q("remove"),x(),clearInterval(ka)}function z(){v(),w(),!0===U&&y()}function A(){var a=document.createElement("div");a.style.clear="both",a.style.display="block",document.body.appendChild(a)}function B(){function c(){return{x:window.pageXOffset!==a?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==a?window.pageYOffset:document.documentElement.scrollTop}}function d(a){var b=a.getBoundingClientRect(),d=c();return{x:parseInt(b.left,10)+parseInt(d.x,10),y:parseInt(b.top,10)+parseInt(d.y,10)}}function e(b){function c(a){var b=d(a);g("Moving to in page link (#"+e+") at x: "+b.x+" y: "+b.y),R(b.y,b.x,"scrollToOffset")}var e=b.split("#")[1]||b,f=decodeURIComponent(e),h=document.getElementById(f)||document.getElementsByName(f)[0];a!==h?c(h):(g("In page link (#"+e+") not found in iFrame, so sending to parent"),R(0,0,"inPageLink","#"+e))}function f(){""!==location.hash&&"#"!==location.hash&&e(location.href)}function i(){function a(a){function c(a){a.preventDefault(),e(this.getAttribute("href"))}"#"!==a.getAttribute("href")&&b(a,"click",c)}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),a)}function j(){b(window,"hashchange",f)}function k(){setTimeout(f,ba)}function l(){Array.prototype.forEach&&document.querySelectorAll?(g("Setting up location.hash handlers"),i(),j(),k()):h("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}return ia.enable?l():g("In page linking not enabled"),{findTarget:e}}function C(){g("Enable public methods"),Ba.parentIFrame={autoResize:function(a){return!0===a&&!1===U?(U=!0,u()):!1===a&&!0===U&&(U=!1,y()),U},close:function(){R(0,0,"close"),z()},getId:function(){return oa},getPageInfo:function(a){"function"==typeof a?(Ea=a,R(0,0,"pageInfo")):(Ea=function(){},R(0,0,"pageInfoStop"))},moveToAnchor:function(a){ia.findTarget(a)},reset:function(){Q("parentIFrame.reset")},scrollTo:function(a,b){R(b,a,"scrollTo")},scrollToOffset:function(a,b){R(b,a,"scrollToOffset")},sendMessage:function(a,b){R(0,0,"message",JSON.stringify(a),b)},setHeightCalculationMethod:function(a){fa=a,s()},setWidthCalculationMethod:function(a){Aa=a,t()},setTargetOrigin:function(a){g("Set targetOrigin: "+a),ta=a},size:function(a,b){var c=""+(a?a:"")+(b?","+b:"");N("size","parentIFrame.size("+c+")",a,b)}}}function D(){0!==ja&&(g("setInterval: "+ja+"ms"),ka=setInterval(function(){N("interval","setInterval: "+ja)},Math.abs(ja)))}function E(){function b(a){function b(a){!1===a.complete&&(g("Attach listeners to "+a.src),a.addEventListener("load",f,!1),a.addEventListener("error",h,!1),k.push(a))}"attributes"===a.type&&"src"===a.attributeName?b(a.target):"childList"===a.type&&Array.prototype.forEach.call(a.target.querySelectorAll("img"),b)}function c(a){k.splice(k.indexOf(a),1)}function d(a){g("Remove listeners from "+a.src),a.removeEventListener("load",f,!1),a.removeEventListener("error",h,!1),c(a)}function e(b,c,e){d(b.target),N(c,e+": "+b.target.src,a,a)}function f(a){e(a,"imageLoad","Image loaded")}function h(a){e(a,"imageLoadFailed","Image load failed")}function i(a){N("mutationObserver","mutationObserver: "+a[0].target+" "+a[0].type),a.forEach(b)}function j(){var a=document.querySelector("body"),b={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0};return m=new l(i),g("Create body MutationObserver"),m.observe(a,b),m}var k=[],l=window.MutationObserver||window.WebKitMutationObserver,m=j();return{disconnect:function(){"disconnect"in m&&(g("Disconnect body MutationObserver"),m.disconnect(),k.forEach(d))}}}function F(){var a=0>ja;window.MutationObserver||window.WebKitMutationObserver?a?D():Z=E():(g("MutationObserver not supported in this browser!"),D())}function G(a,b){function c(a){var c=/^\d+(px)?$/i;if(c.test(a))return parseInt(a,V);var d=b.style.left,e=b.runtimeStyle.left;return b.runtimeStyle.left=b.currentStyle.left,b.style.left=a||0,a=b.style.pixelLeft,b.style.left=d,b.runtimeStyle.left=e,a}var d=0;return b=b||document.body,"defaultView"in document&&"getComputedStyle"in document.defaultView?(d=document.defaultView.getComputedStyle(b,null),d=null!==d?d[a]:0):d=c(b.currentStyle[a]),parseInt(d,V)}function H(a){a>xa/2&&(xa=2*a,g("Event throttle increased to "+xa+"ms"))}function I(a,b){for(var c=b.length,e=0,f=0,h=d(a),i=Ha(),j=0;c>j;j++)e=b[j].getBoundingClientRect()[a]+G("margin"+h,b[j]),e>f&&(f=e);return i=Ha()-i,g("Parsed "+c+" HTML elements"),g("Element position calculated in "+i+"ms"),H(i),f}function J(a){return[a.bodyOffset(),a.bodyScroll(),a.documentElementOffset(),a.documentElementScroll()]}function K(a,b){function c(){return h("No tagged elements ("+b+") found on page"),document.querySelectorAll("body *")}var d=document.querySelectorAll("["+b+"]");return 0===d.length&&c(),I(a,d)}function L(){return document.querySelectorAll("body *")}function M(b,c,d,e){function f(){da=m,ya=n,R(da,ya,b)}function h(){function b(a,b){var c=Math.abs(a-b)<=ua;return!c}return m=a!==d?d:Ia[fa](),n=a!==e?e:Ja[Aa](),b(da,m)||_&&b(ya,n)}function i(){return!(b in{init:1,interval:1,size:1})}function j(){return fa in pa||_&&Aa in pa}function k(){g("No change in size detected")}function l(){i()&&j()?Q(c):b in{interval:1}||k()}var m,n;h()||"init"===b?(O(),f()):l()}function N(a,b,c,d){function e(){a in{reset:1,resetPage:1,init:1}||g("Trigger event: "+b)}function f(){return va&&a in aa}f()?g("Trigger event cancelled: "+a):(e(),Ka(a,b,c,d))}function O(){va||(va=!0,g("Trigger event lock on")),clearTimeout(wa),wa=setTimeout(function(){va=!1,g("Trigger event lock off"),g("--")},ba)}function P(a){da=Ia[fa](),ya=Ja[Aa](),R(da,ya,a)}function Q(a){var b=fa;fa=ea,g("Reset trigger event: "+a),O(),P("reset"),fa=b}function R(b,c,d,e,f){function h(){a===f?f=ta:g("Message targetOrigin: "+f)}function i(){var h=b+":"+c,i=oa+":"+h+":"+d+(a!==e?":"+e:"");g("Sending message to host page ("+i+")"),sa.postMessage(ma+i,f)}!0===ra&&(h(),i())}function S(a){function c(){return ma===(""+a.data).substr(0,na)}function d(){return a.data.split("]")[1].split(":")[0]}function e(){return a.data.substr(a.data.indexOf(":")+1)}function f(){return!("undefined"!=typeof module&&module.exports)&&"iFrameResize"in window}function j(){return a.data.split(":")[2]in{"true":1,"false":1}}function k(){var b=d();b in m?m[b]():f()||j()||h("Unexpected message ("+a.data+")")}function l(){!1===ca?k():j()?m.init():g('Ignored message of type "'+d()+'". Received before initialization.')}var m={init:function(){function c(){ha=a.data,sa=a.source,i(),ca=!1,setTimeout(function(){ga=!1},ba)}document.body?c():(g("Waiting for page ready"),b(window,"readystatechange",m.initFromParent))},reset:function(){ga?g("Page reset ignored by init"):(g("Page size reset by host page"),P("resetPage"))},resize:function(){N("resizeParent","Parent window requested size check")},moveToAnchor:function(){ia.findTarget(e())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var a=e();g("PageInfoFromParent called from parent: "+a),Ea(JSON.parse(a)),g(" --")},message:function(){var a=e();g("MessageCallback called from parent: "+a),Ca(JSON.parse(a)),g(" --")}};c()&&l()}function T(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}if("undefined"!=typeof window){var U=!0,V=10,W="",X=0,Y="",Z=null,$="",_=!1,aa={resize:1,click:1},ba=128,ca=!0,da=1,ea="bodyOffset",fa=ea,ga=!0,ha="",ia={},ja=32,ka=null,la=!1,ma="[iFrameSizer]",na=ma.length,oa="",pa={max:1,min:1,bodyScroll:1,documentElementScroll:1},qa="child",ra=!0,sa=window.parent,ta="*",ua=0,va=!1,wa=null,xa=16,ya=1,za="scroll",Aa=za,Ba=window,Ca=function(){h("MessageCallback function not defined")},Da=function(){},Ea=function(){},Fa={height:function(){return h("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return h("Custom width calculation function not defined"),document.body.scrollWidth}},Ga={},Ha=Date.now||function(){return(new Date).getTime()},Ia={bodyOffset:function(){return document.body.offsetHeight+G("marginTop")+G("marginBottom")},offset:function(){return Ia.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return Fa.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,J(Ia))},min:function(){return Math.min.apply(null,J(Ia))},grow:function(){return Ia.max()},lowestElement:function(){return Math.max(Ia.bodyOffset(),I("bottom",L()))},taggedElement:function(){return K("bottom","data-iframe-height")}},Ja={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return Fa.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(Ja.bodyScroll(),Ja.documentElementScroll())},max:function(){return Math.max.apply(null,J(Ja))},min:function(){return Math.min.apply(null,J(Ja))},rightMostElement:function(){return I("right",L())},taggedElement:function(){return K("right","data-iframe-width")}},Ka=e(M);b(window,"message",S),T()}}(); -//# sourceMappingURL=iframeResizer.contentWindow.map \ No newline at end of file +(function(undefined){"use strict";if(typeof window==="undefined")return;var autoResize=true,base=10,bodyBackground="",bodyMargin=0,bodyMarginStr="",bodyObserver=null,bodyPadding="",calculateWidth=false,doubleEventList={resize:1,click:1},eventCancelTimer=128,firstRun=true,height=1,heightCalcModeDefault="bodyOffset",heightCalcMode=heightCalcModeDefault,initLock=true,initMsg="",inPageLinks={},interval=32,intervalTimer=null,logging=false,msgID="[iFrameSizer]",msgIdLen=msgID.length,myID="",observer=null,resetRequiredMethods={max:1,min:1,bodyScroll:1,documentElementScroll:1},resizeFrom="child",sendPermit=true,target=window.parent,targetOriginDefault="*",tolerance=0,triggerLocked=false,triggerLockedTimer=null,throttledTimer=16,width=1,widthCalcModeDefault="scroll",widthCalcMode=widthCalcModeDefault,win=window,messageCallback=function(){warn("MessageCallback function not defined")},readyCallback=function(){},pageInfoCallback=function(){},customCalcMethods={height:function(){warn("Custom height calculation function not defined");return document.documentElement.offsetHeight},width:function(){warn("Custom width calculation function not defined");return document.body.scrollWidth}},eventHandlersByName={};function addEventListener(el,evt,func){if("addEventListener"in window){el.addEventListener(evt,func,false)}else if("attachEvent"in window){el.attachEvent("on"+evt,func)}}function removeEventListener(el,evt,func){if("removeEventListener"in window){el.removeEventListener(evt,func,false)}else if("detachEvent"in window){el.detachEvent("on"+evt,func)}}function capitalizeFirstLetter(string){return string.charAt(0).toUpperCase()+string.slice(1)}function throttle(func){var context,args,result,timeout=null,previous=0,later=function(){previous=getNow();timeout=null;result=func.apply(context,args);if(!timeout){context=args=null}};return function(){var now=getNow();if(!previous){previous=now}var remaining=throttledTimer-(now-previous);context=this;args=arguments;if(remaining<=0||remaining>throttledTimer){if(timeout){clearTimeout(timeout);timeout=null}previous=now;result=func.apply(context,args);if(!timeout){context=args=null}}else if(!timeout){timeout=setTimeout(later,remaining)}return result}}var getNow=Date.now||function(){return(new Date).getTime()};function formatLogMsg(msg){return msgID+"["+myID+"]"+" "+msg}function log(msg){if(logging&&"object"===typeof window.console){console.log(formatLogMsg(msg))}}function warn(msg){if("object"===typeof window.console){console.warn(formatLogMsg(msg))}}function init(){readDataFromParent();log("Initialising iFrame ("+location.href+")");readDataFromPage();setMargin();setBodyStyle("background",bodyBackground);setBodyStyle("padding",bodyPadding);injectClearFixIntoBodyElement();checkHeightMode();checkWidthMode();stopInfiniteResizingOfIFrame();setupPublicMethods();startEventListeners();inPageLinks=setupInPageLinks();sendSize("init","Init message from host page");readyCallback()}function readDataFromParent(){function strBool(str){return"true"===str?true:false}var data=initMsg.substr(msgIdLen).split(":");myID=data[0];bodyMargin=undefined!==data[1]?Number(data[1]):bodyMargin;calculateWidth=undefined!==data[2]?strBool(data[2]):calculateWidth;logging=undefined!==data[3]?strBool(data[3]):logging;interval=undefined!==data[4]?Number(data[4]):interval;autoResize=undefined!==data[6]?strBool(data[6]):autoResize;bodyMarginStr=data[7];heightCalcMode=undefined!==data[8]?data[8]:heightCalcMode;bodyBackground=data[9];bodyPadding=data[10];tolerance=undefined!==data[11]?Number(data[11]):tolerance;inPageLinks.enable=undefined!==data[12]?strBool(data[12]):false;resizeFrom=undefined!==data[13]?data[13]:resizeFrom;widthCalcMode=undefined!==data[14]?data[14]:widthCalcMode}function readDataFromPage(){function readData(){var data=window.iFrameResizer;log("Reading data from page: "+JSON.stringify(data));messageCallback="messageCallback"in data?data.messageCallback:messageCallback;readyCallback="readyCallback"in data?data.readyCallback:readyCallback;targetOriginDefault="targetOrigin"in data?data.targetOrigin:targetOriginDefault;heightCalcMode="heightCalculationMethod"in data?data.heightCalculationMethod:heightCalcMode;widthCalcMode="widthCalculationMethod"in data?data.widthCalculationMethod:widthCalcMode}function setupCustomCalcMethods(calcMode,calcFunc){if("function"===typeof calcMode){log("Setup custom "+calcFunc+"CalcMethod");customCalcMethods[calcFunc]=calcMode;calcMode="custom"}return calcMode}if("iFrameResizer"in window&&Object===window.iFrameResizer.constructor){readData();heightCalcMode=setupCustomCalcMethods(heightCalcMode,"height");widthCalcMode=setupCustomCalcMethods(widthCalcMode,"width")}log("TargetOrigin for parent set to: "+targetOriginDefault)}function chkCSS(attr,value){if(-1!==value.indexOf("-")){warn("Negative CSS value ignored for "+attr);value=""}return value}function setBodyStyle(attr,value){if(undefined!==value&&""!==value&&"null"!==value){document.body.style[attr]=value;log("Body "+attr+' set to "'+value+'"')}}function setMargin(){if(undefined===bodyMarginStr){bodyMarginStr=bodyMargin+"px"}setBodyStyle("margin",chkCSS("margin",bodyMarginStr))}function stopInfiniteResizingOfIFrame(){document.documentElement.style.height="";document.body.style.height="";log('HTML & body height set to "auto"')}function manageTriggerEvent(options){var listener={add:function(eventName){function handleEvent(){sendSize(options.eventName,options.eventType)}eventHandlersByName[eventName]=handleEvent;addEventListener(window,eventName,handleEvent)},remove:function(eventName){var handleEvent=eventHandlersByName[eventName];delete eventHandlersByName[eventName];removeEventListener(window,eventName,handleEvent)}};if(options.eventNames&&Array.prototype.map){options.eventName=options.eventNames[0];options.eventNames.map(listener[options.method])}else{listener[options.method](options.eventName)}log(capitalizeFirstLetter(options.method)+" event listener: "+options.eventType)}function manageEventListeners(method){manageTriggerEvent({method:method,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]});manageTriggerEvent({method:method,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]});manageTriggerEvent({method:method,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]});manageTriggerEvent({method:method,eventType:"Input",eventName:"input"});manageTriggerEvent({method:method,eventType:"Mouse Up",eventName:"mouseup"});manageTriggerEvent({method:method,eventType:"Mouse Down",eventName:"mousedown"});manageTriggerEvent({method:method,eventType:"Orientation Change",eventName:"orientationchange"});manageTriggerEvent({method:method,eventType:"Print",eventName:["afterprint","beforeprint"]});manageTriggerEvent({method:method,eventType:"Ready State Change",eventName:"readystatechange"});manageTriggerEvent({method:method,eventType:"Touch Start",eventName:"touchstart"});manageTriggerEvent({method:method,eventType:"Touch End",eventName:"touchend"});manageTriggerEvent({method:method,eventType:"Touch Cancel",eventName:"touchcancel"});manageTriggerEvent({method:method,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]});manageTriggerEvent({method:method,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]});manageTriggerEvent({method:method,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]});if("child"===resizeFrom){manageTriggerEvent({method:method,eventType:"IFrame Resized",eventName:"resize"})}}function checkCalcMode(calcMode,calcModeDefault,modes,type){if(calcModeDefault!==calcMode){if(!(calcMode in modes)){warn(calcMode+" is not a valid option for "+type+"CalculationMethod.");calcMode=calcModeDefault}log(type+' calculation method set to "'+calcMode+'"')}return calcMode}function checkHeightMode(){heightCalcMode=checkCalcMode(heightCalcMode,heightCalcModeDefault,getHeight,"height")}function checkWidthMode(){widthCalcMode=checkCalcMode(widthCalcMode,widthCalcModeDefault,getWidth,"width")}function startEventListeners(){if(true===autoResize){manageEventListeners("add");setupMutationObserver()}else{log("Auto Resize disabled")}}function stopMsgsToParent(){log("Disable outgoing messages");sendPermit=false}function removeMsgListener(){log("Remove event listener: Message");removeEventListener(window,"message",receiver)}function disconnectMutationObserver(){if(null!==bodyObserver){bodyObserver.disconnect()}}function stopEventListeners(){manageEventListeners("remove");disconnectMutationObserver();clearInterval(intervalTimer)}function teardown(){stopMsgsToParent();removeMsgListener();if(true===autoResize)stopEventListeners()}function injectClearFixIntoBodyElement(){var clearFix=document.createElement("div");clearFix.style.clear="both";clearFix.style.display="block";document.body.appendChild(clearFix)}function setupInPageLinks(){function getPagePosition(){return{x:window.pageXOffset!==undefined?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==undefined?window.pageYOffset:document.documentElement.scrollTop}}function getElementPosition(el){var elPosition=el.getBoundingClientRect(),pagePosition=getPagePosition();return{x:parseInt(elPosition.left,10)+parseInt(pagePosition.x,10),y:parseInt(elPosition.top,10)+parseInt(pagePosition.y,10)}}function findTarget(location){function jumpToTarget(target){var jumpPosition=getElementPosition(target);log("Moving to in page link (#"+hash+") at x: "+jumpPosition.x+" y: "+jumpPosition.y);sendMsg(jumpPosition.y,jumpPosition.x,"scrollToOffset")}var hash=location.split("#")[1]||location,hashData=decodeURIComponent(hash),target=hashData?document.getElementById(hashData)||document.getElementsByName(hashData)[0]:null;if(undefined!==target){jumpToTarget(target)}else{log("In page link (#"+hash+") not found in iFrame, so sending to parent");sendMsg(0,0,"inPageLink","#"+hash)}}function checkLocationHash(){if(""!==location.hash&&"#"!==location.hash){findTarget(location.href)}}function bindAnchors(){function setupLink(el){function linkClicked(e){e.preventDefault();findTarget(this.getAttribute("href"))}if("#"!==el.getAttribute("href")){addEventListener(el,"click",linkClicked)}}Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),setupLink)}function bindLocationHash(){addEventListener(window,"hashchange",checkLocationHash)}function initCheck(){setTimeout(checkLocationHash,eventCancelTimer)}function enableInPageLinks(){if(Array.prototype.forEach&&document.querySelectorAll){log("Setting up location.hash handlers");bindAnchors();bindLocationHash();initCheck()}else{warn("In page linking not fully supported in this browser! (See README.md for IE8 workaround)")}}if(inPageLinks.enable){enableInPageLinks()}else{log("In page linking not enabled")}return{findTarget:findTarget}}function setupPublicMethods(){log("Enable public methods");win.parentIFrame={autoResize:function autoResizeF(resize){if(true===resize&&false===autoResize){autoResize=true;startEventListeners()}else if(false===resize&&true===autoResize){autoResize=false;stopEventListeners()}return autoResize},close:function closeF(){sendMsg(0,0,"close");teardown()},getId:function getIdF(){return myID},getPageInfo:function getPageInfoF(callback){if("function"===typeof callback){pageInfoCallback=callback;sendMsg(0,0,"pageInfo")}else{pageInfoCallback=function(){};sendMsg(0,0,"pageInfoStop")}},moveToAnchor:function moveToAnchorF(hash){inPageLinks.findTarget(hash)},reset:function resetF(){resetIFrame("parentIFrame.reset")},scrollTo:function scrollToF(x,y){sendMsg(y,x,"scrollTo")},scrollToOffset:function scrollToF(x,y){sendMsg(y,x,"scrollToOffset")},sendMessage:function sendMessageF(msg,targetOrigin){sendMsg(0,0,"message",JSON.stringify(msg),targetOrigin)},setHeightCalculationMethod:function setHeightCalculationMethodF(heightCalculationMethod){heightCalcMode=heightCalculationMethod;checkHeightMode()},setWidthCalculationMethod:function setWidthCalculationMethodF(widthCalculationMethod){widthCalcMode=widthCalculationMethod;checkWidthMode()},setTargetOrigin:function setTargetOriginF(targetOrigin){log("Set targetOrigin: "+targetOrigin);targetOriginDefault=targetOrigin},size:function sizeF(customHeight,customWidth){var valString=""+(customHeight?customHeight:"")+(customWidth?","+customWidth:"");sendSize("size","parentIFrame.size("+valString+")",customHeight,customWidth)}}}function initInterval(){if(0!==interval){log("setInterval: "+interval+"ms");intervalTimer=setInterval((function(){sendSize("interval","setInterval: "+interval)}),Math.abs(interval))}}function setupBodyMutationObserver(){function addImageLoadListners(mutation){function addImageLoadListener(element){if(false===element.complete){log("Attach listeners to "+element.src);element.addEventListener("load",imageLoaded,false);element.addEventListener("error",imageError,false);elements.push(element)}}if(mutation.type==="attributes"&&mutation.attributeName==="src"){addImageLoadListener(mutation.target)}else if(mutation.type==="childList"){Array.prototype.forEach.call(mutation.target.querySelectorAll("img"),addImageLoadListener)}}function removeFromArray(element){elements.splice(elements.indexOf(element),1)}function removeImageLoadListener(element){log("Remove listeners from "+element.src);element.removeEventListener("load",imageLoaded,false);element.removeEventListener("error",imageError,false);removeFromArray(element)}function imageEventTriggered(event,type,typeDesc){removeImageLoadListener(event.target);sendSize(type,typeDesc+": "+event.target.src,undefined,undefined)}function imageLoaded(event){imageEventTriggered(event,"imageLoad","Image loaded")}function imageError(event){imageEventTriggered(event,"imageLoadFailed","Image load failed")}function mutationObserved(mutations){sendSize("mutationObserver","mutationObserver: "+mutations[0].target+" "+mutations[0].type);mutations.forEach(addImageLoadListners)}function createMutationObserver(){var target=document.querySelector("body"),config={attributes:true,attributeOldValue:false,characterData:true,characterDataOldValue:false,childList:true,subtree:true};observer=new MutationObserver(mutationObserved);log("Create body MutationObserver");observer.observe(target,config);return observer}var elements=[],MutationObserver=window.MutationObserver||window.WebKitMutationObserver,observer=createMutationObserver();return{disconnect:function(){if("disconnect"in observer){log("Disconnect body MutationObserver");observer.disconnect();elements.forEach(removeImageLoadListener)}}}}function setupMutationObserver(){var forceIntervalTimer=0>interval;if(window.MutationObserver||window.WebKitMutationObserver){if(forceIntervalTimer){initInterval()}else{bodyObserver=setupBodyMutationObserver()}}else{log("MutationObserver not supported in this browser!");initInterval()}}function getComputedStyle(prop,el){function convertUnitsToPxForIE8(value){var PIXEL=/^\d+(px)?$/i;if(PIXEL.test(value)){return parseInt(value,base)}var style=el.style.left,runtimeStyle=el.runtimeStyle.left;el.runtimeStyle.left=el.currentStyle.left;el.style.left=value||0;value=el.style.pixelLeft;el.style.left=style;el.runtimeStyle.left=runtimeStyle;return value}var retVal=0;el=el||document.body;if("defaultView"in document&&"getComputedStyle"in document.defaultView){retVal=document.defaultView.getComputedStyle(el,null);retVal=null!==retVal?retVal[prop]:0}else{retVal=convertUnitsToPxForIE8(el.currentStyle[prop])}return parseInt(retVal,base)}function chkEventThottle(timer){if(timer>throttledTimer/2){throttledTimer=2*timer;log("Event throttle increased to "+throttledTimer+"ms")}}function getMaxElement(side,elements){var elementsLength=elements.length,elVal=0,maxVal=0,Side=capitalizeFirstLetter(side),timer=getNow();for(var i=0;imaxVal){maxVal=elVal}}timer=getNow()-timer;log("Parsed "+elementsLength+" HTML elements");log("Element position calculated in "+timer+"ms");chkEventThottle(timer);return maxVal}function getAllMeasurements(dimention){return[dimention.bodyOffset(),dimention.bodyScroll(),dimention.documentElementOffset(),dimention.documentElementScroll()]}function getTaggedElements(side,tag){function noTaggedElementsFound(){warn("No tagged elements ("+tag+") found on page");return document.querySelectorAll("body *")}var elements=document.querySelectorAll("["+tag+"]");if(0===elements.length)noTaggedElementsFound();return getMaxElement(side,elements)}function getAllElements(){return document.querySelectorAll("body *")}var getHeight={bodyOffset:function getBodyOffsetHeight(){return document.body.offsetHeight+getComputedStyle("marginTop")+getComputedStyle("marginBottom")},offset:function(){return getHeight.bodyOffset()},bodyScroll:function getBodyScrollHeight(){return document.body.scrollHeight},custom:function getCustomWidth(){return customCalcMethods.height()},documentElementOffset:function getDEOffsetHeight(){return document.documentElement.offsetHeight},documentElementScroll:function getDEScrollHeight(){return document.documentElement.scrollHeight},max:function getMaxHeight(){return Math.max.apply(null,getAllMeasurements(getHeight))},min:function getMinHeight(){return Math.min.apply(null,getAllMeasurements(getHeight))},grow:function growHeight(){return getHeight.max()},lowestElement:function getBestHeight(){return Math.max(getHeight.bodyOffset(),getMaxElement("bottom",getAllElements()))},taggedElement:function getTaggedElementsHeight(){return getTaggedElements("bottom","data-iframe-height")}},getWidth={bodyScroll:function getBodyScrollWidth(){return document.body.scrollWidth},bodyOffset:function getBodyOffsetWidth(){return document.body.offsetWidth},custom:function getCustomWidth(){return customCalcMethods.width()},documentElementScroll:function getDEScrollWidth(){return document.documentElement.scrollWidth},documentElementOffset:function getDEOffsetWidth(){return document.documentElement.offsetWidth},scroll:function getMaxWidth(){return Math.max(getWidth.bodyScroll(),getWidth.documentElementScroll())},max:function getMaxWidth(){return Math.max.apply(null,getAllMeasurements(getWidth))},min:function getMinWidth(){return Math.min.apply(null,getAllMeasurements(getWidth))},rightMostElement:function rightMostElement(){return getMaxElement("right",getAllElements())},taggedElement:function getTaggedElementsWidth(){return getTaggedElements("right","data-iframe-width")}};function sizeIFrame(triggerEvent,triggerEventDesc,customHeight,customWidth){function resizeIFrame(){height=currentHeight;width=currentWidth;sendMsg(height,width,triggerEvent)}function isSizeChangeDetected(){function checkTolarance(a,b){var retVal=Math.abs(a-b)<=tolerance;return!retVal}currentHeight=undefined!==customHeight?customHeight:getHeight[heightCalcMode]();currentWidth=undefined!==customWidth?customWidth:getWidth[widthCalcMode]();return checkTolarance(height,currentHeight)||calculateWidth&&checkTolarance(width,currentWidth)}function isForceResizableEvent(){return!(triggerEvent in{init:1,interval:1,size:1})}function isForceResizableCalcMode(){return heightCalcMode in resetRequiredMethods||calculateWidth&&widthCalcMode in resetRequiredMethods}function logIgnored(){log("No change in size detected")}function checkDownSizing(){if(isForceResizableEvent()&&isForceResizableCalcMode()){resetIFrame(triggerEventDesc)}else if(!(triggerEvent in{interval:1})){logIgnored()}}var currentHeight,currentWidth;if(isSizeChangeDetected()||"init"===triggerEvent){lockTrigger();resizeIFrame()}else{checkDownSizing()}}var sizeIFrameThrottled=throttle(sizeIFrame);function sendSize(triggerEvent,triggerEventDesc,customHeight,customWidth){function recordTrigger(){if(!(triggerEvent in{reset:1,resetPage:1,init:1})){log("Trigger event: "+triggerEventDesc)}}function isDoubleFiredEvent(){return triggerLocked&&triggerEvent in doubleEventList}if(!isDoubleFiredEvent()){recordTrigger();sizeIFrameThrottled(triggerEvent,triggerEventDesc,customHeight,customWidth)}else{log("Trigger event cancelled: "+triggerEvent)}}function lockTrigger(){if(!triggerLocked){triggerLocked=true;log("Trigger event lock on")}clearTimeout(triggerLockedTimer);triggerLockedTimer=setTimeout((function(){triggerLocked=false;log("Trigger event lock off");log("--")}),eventCancelTimer)}function triggerReset(triggerEvent){height=getHeight[heightCalcMode]();width=getWidth[widthCalcMode]();sendMsg(height,width,triggerEvent)}function resetIFrame(triggerEventDesc){var hcm=heightCalcMode;heightCalcMode=heightCalcModeDefault;log("Reset trigger event: "+triggerEventDesc);lockTrigger();triggerReset("reset");heightCalcMode=hcm}function sendMsg(height,width,triggerEvent,msg,targetOrigin){function setTargetOrigin(){if(undefined===targetOrigin){targetOrigin=targetOriginDefault}else{log("Message targetOrigin: "+targetOrigin)}}function sendToParent(){var size=height+":"+width,message=myID+":"+size+":"+triggerEvent+(undefined!==msg?":"+msg:"");log("Sending message to host page ("+message+")");target.postMessage(msgID+message,targetOrigin)}if(true===sendPermit){setTargetOrigin();sendToParent()}}function receiver(event){var processRequestFromParent={init:function initFromParent(){function fireInit(){initMsg=event.data;target=event.source;init();firstRun=false;setTimeout((function(){initLock=false}),eventCancelTimer)}if(document.body){fireInit()}else{log("Waiting for page ready");addEventListener(window,"readystatechange",processRequestFromParent.initFromParent)}},reset:function resetFromParent(){if(!initLock){log("Page size reset by host page");triggerReset("resetPage")}else{log("Page reset ignored by init")}},resize:function resizeFromParent(){sendSize("resizeParent","Parent window requested size check")},moveToAnchor:function moveToAnchorF(){inPageLinks.findTarget(getData())},inPageLink:function inPageLinkF(){this.moveToAnchor()},pageInfo:function pageInfoFromParent(){var msgBody=getData();log("PageInfoFromParent called from parent: "+msgBody);pageInfoCallback(JSON.parse(msgBody));log(" --")},message:function messageFromParent(){var msgBody=getData();log("MessageCallback called from parent: "+msgBody);messageCallback(JSON.parse(msgBody));log(" --")}};function isMessageForUs(){return msgID===(""+event.data).substr(0,msgIdLen)}function getMessageType(){return event.data.split("]")[1].split(":")[0]}function getData(){return event.data.substr(event.data.indexOf(":")+1)}function isMiddleTier(){return!(typeof module!=="undefined"&&module.exports)&&"iFrameResize"in window}function isInitMsg(){return event.data.split(":")[2]in{true:1,false:1}}function callFromParent(){var messageType=getMessageType();if(messageType in processRequestFromParent){processRequestFromParent[messageType]()}else if(!isMiddleTier()&&!isInitMsg()){warn("Unexpected message ("+event.data+")")}}function processMessage(){if(false===firstRun){callFromParent()}else if(isInitMsg()){processRequestFromParent.init()}else{log('Ignored message of type "'+getMessageType()+'". Received before initialization.')}}if(isMessageForUs()){processMessage()}}function chkLateLoaded(){if("loading"!==document.readyState){window.parent.postMessage("[iFrameResizerChild]Ready","*")}}addEventListener(window,"message",receiver);chkLateLoaded()})(); \ No newline at end of file diff --git a/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.min.js.map b/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.min.js.map new file mode 100644 index 0000000..38c9a90 --- /dev/null +++ b/remarkbox/static/js/iframe-resizer/iframeResizer.contentWindow.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"iframeResizer.contentWindow.min.js.map","names":["undefined","window","autoResize","base","bodyBackground","bodyMargin","bodyMarginStr","bodyObserver","bodyPadding","calculateWidth","doubleEventList","resize","click","eventCancelTimer","firstRun","height","heightCalcModeDefault","heightCalcMode","initLock","initMsg","inPageLinks","interval","intervalTimer","logging","msgID","msgIdLen","length","myID","observer","resetRequiredMethods","max","min","bodyScroll","documentElementScroll","resizeFrom","sendPermit","target","parent","targetOriginDefault","tolerance","triggerLocked","triggerLockedTimer","throttledTimer","width","widthCalcModeDefault","widthCalcMode","win","messageCallback","warn","readyCallback","pageInfoCallback","customCalcMethods","document","documentElement","offsetHeight","body","scrollWidth","eventHandlersByName","addEventListener","el","evt","func","attachEvent","removeEventListener","detachEvent","capitalizeFirstLetter","string","charAt","toUpperCase","slice","throttle","context","args","result","timeout","previous","later","getNow","apply","now","remaining","this","arguments","clearTimeout","setTimeout","Date","getTime","formatLogMsg","msg","log","console","init","readDataFromParent","location","href","readDataFromPage","setMargin","setBodyStyle","injectClearFixIntoBodyElement","checkHeightMode","checkWidthMode","stopInfiniteResizingOfIFrame","setupPublicMethods","startEventListeners","setupInPageLinks","sendSize","strBool","str","data","substr","split","Number","enable","readData","iFrameResizer","JSON","stringify","targetOrigin","heightCalculationMethod","widthCalculationMethod","setupCustomCalcMethods","calcMode","calcFunc","Object","constructor","chkCSS","attr","value","indexOf","style","manageTriggerEvent","options","listener","add","eventName","handleEvent","eventType","remove","eventNames","Array","prototype","map","method","manageEventListeners","checkCalcMode","calcModeDefault","modes","type","getHeight","getWidth","setupMutationObserver","stopMsgsToParent","removeMsgListener","receiver","disconnectMutationObserver","disconnect","stopEventListeners","clearInterval","teardown","clearFix","createElement","clear","display","appendChild","getPagePosition","x","pageXOffset","scrollLeft","y","pageYOffset","scrollTop","getElementPosition","elPosition","getBoundingClientRect","pagePosition","parseInt","left","top","findTarget","jumpToTarget","jumpPosition","hash","sendMsg","hashData","decodeURIComponent","getElementById","getElementsByName","checkLocationHash","bindAnchors","setupLink","linkClicked","e","preventDefault","getAttribute","forEach","call","querySelectorAll","bindLocationHash","initCheck","enableInPageLinks","parentIFrame","autoResizeF","close","closeF","getId","getIdF","getPageInfo","getPageInfoF","callback","moveToAnchor","moveToAnchorF","reset","resetF","resetIFrame","scrollTo","scrollToF","scrollToOffset","sendMessage","sendMessageF","setHeightCalculationMethod","setHeightCalculationMethodF","setWidthCalculationMethod","setWidthCalculationMethodF","setTargetOrigin","setTargetOriginF","size","sizeF","customHeight","customWidth","valString","initInterval","setInterval","Math","abs","setupBodyMutationObserver","addImageLoadListners","mutation","addImageLoadListener","element","complete","src","imageLoaded","imageError","elements","push","attributeName","removeFromArray","splice","removeImageLoadListener","imageEventTriggered","event","typeDesc","mutationObserved","mutations","createMutationObserver","querySelector","config","attributes","attributeOldValue","characterData","characterDataOldValue","childList","subtree","MutationObserver","observe","WebKitMutationObserver","forceIntervalTimer","getComputedStyle","prop","convertUnitsToPxForIE8","PIXEL","test","runtimeStyle","currentStyle","pixelLeft","retVal","defaultView","chkEventThottle","timer","getMaxElement","side","elementsLength","elVal","maxVal","Side","i","getAllMeasurements","dimention","bodyOffset","documentElementOffset","getTaggedElements","tag","noTaggedElementsFound","getAllElements","getBodyOffsetHeight","offset","getBodyScrollHeight","scrollHeight","custom","getCustomWidth","getDEOffsetHeight","getDEScrollHeight","getMaxHeight","getMinHeight","grow","growHeight","lowestElement","getBestHeight","taggedElement","getTaggedElementsHeight","getBodyScrollWidth","getBodyOffsetWidth","offsetWidth","getDEScrollWidth","getDEOffsetWidth","scroll","getMaxWidth","getMinWidth","rightMostElement","getTaggedElementsWidth","sizeIFrame","triggerEvent","triggerEventDesc","resizeIFrame","currentHeight","currentWidth","isSizeChangeDetected","checkTolarance","a","b","isForceResizableEvent","isForceResizableCalcMode","logIgnored","checkDownSizing","lockTrigger","sizeIFrameThrottled","recordTrigger","resetPage","isDoubleFiredEvent","triggerReset","hcm","sendToParent","message","postMessage","processRequestFromParent","initFromParent","fireInit","source","resetFromParent","resizeFromParent","getData","inPageLink","inPageLinkF","pageInfo","pageInfoFromParent","msgBody","parse","messageFromParent","isMessageForUs","getMessageType","isMiddleTier","module","exports","isInitMsg","true","false","callFromParent","messageType","processMessage","chkLateLoaded","readyState"],"sources":["iframeResizer.contentWindow.js"],"mappings":"CAYC,SAAUA,WACV,aAEA,UAAUC,SAAW,YAAa,OAElC,IACCC,WAAwB,KACxBC,KAAwB,GACxBC,eAAwB,GACxBC,WAAwB,EACxBC,cAAwB,GACxBC,aAAwB,KACxBC,YAAwB,GACxBC,eAAwB,MACxBC,gBAAwB,CAACC,OAAS,EAAEC,MAAQ,GAC5CC,iBAAwB,IACxBC,SAAwB,KACxBC,OAAwB,EACxBC,sBAAwB,aACxBC,eAAwBD,sBACxBE,SAAwB,KACxBC,QAAwB,GACxBC,YAAwB,CAAC,EACzBC,SAAwB,GACxBC,cAAwB,KACxBC,QAAwB,MACxBC,MAAwB,gBACxBC,SAAwBD,MAAME,OAC9BC,KAAwB,GACxBC,SAAwB,KACxBC,qBAAwB,CAACC,IAAI,EAAEC,IAAI,EAAEC,WAAW,EAAEC,sBAAsB,GACxEC,WAAwB,QACxBC,WAAwB,KACxBC,OAAwBnC,OAAOoC,OAC/BC,oBAAwB,IACxBC,UAAwB,EACxBC,cAAwB,MACxBC,mBAAwB,KACxBC,eAAwB,GACxBC,MAAwB,EACxBC,qBAAwB,SACxBC,cAAwBD,qBACxBE,IAAwB7C,OACxB8C,gBAAwB,WAAYC,KAAK,uCAAyC,EAClFC,cAAwB,WAAW,EACnCC,iBAAwB,WAAW,EACnCC,kBAAwB,CACvBpC,OAAQ,WACPiC,KAAK,kDACL,OAAOI,SAASC,gBAAgBC,YACjC,EACAX,MAAO,WACNK,KAAK,iDACL,OAAOI,SAASG,KAAKC,WACtB,GAEDC,oBAAwB,CAAC,EAG1B,SAASC,iBAAiBC,GAAGC,IAAIC,MAEhC,GAAI,qBAAsB5D,OAAO,CAChC0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AAK,EAClD,CAEA,SAASwO,eACR,eAAgBC,SAAW,aAAeA,OAAOC,UAAa,iBAAkBzW,MACjF,CAEA,SAAS0W,YAGR,OAAOjH,MAAM9I,KAAKE,MAAM,KAAK,IAAM,CAAC8P,KAAO,EAAEC,MAAQ,EACtD,CAEA,SAASC,iBACR,IAAIC,YAAcR,iBAElB,GAAIQ,eAAevB,yBAAyB,CAC3CA,yBAAyBuB,cAC1B,MAAO,IAAKP,iBAAmBG,YAAY,CAC1C3T,KAAK,uBAAuB0M,MAAM9I,KAAK,IACxC,CACD,CAEA,SAASoQ,iBACR,GAAI,QAAUlW,SAAU,CACvBgW,gBACD,MAAO,GAAIH,YAAa,CACvBnB,yBAAyB7P,MAC1B,KAAO,CACNF,IAAI,4BAA8B8Q,iBAAmB,qCACtD,CACD,CAEA,GAAID,iBAAiB,CACpBU,gBACD,CACD,CAIA,SAASC,gBACR,GAAG,YAAc7T,SAAS8T,WAAW,CACpCjX,OAAOoC,OAAOkT,YAAY,4BAA4B,IACvD,CACD,CAEA7R,iBAAiBzD,OAAQ,UAAWwJ,UACpCwN,eAIA,EArkCA"} \ No newline at end of file diff --git a/remarkbox/static/js/iframe-resizer/iframeResizer.js b/remarkbox/static/js/iframe-resizer/iframeResizer.js index a8a6995..bc23242 100644 --- a/remarkbox/static/js/iframe-resizer/iframeResizer.js +++ b/remarkbox/static/js/iframe-resizer/iframeResizer.js @@ -413,7 +413,7 @@ var hash = location.split('#')[1] || '', hashData = decodeURIComponent(hash), - target = document.getElementById(hashData) || document.getElementsByName(hashData)[0]; + target = hashData ? (document.getElementById(hashData) || document.getElementsByName(hashData)[0]) : null; if (target){ jumpToTarget(); diff --git a/remarkbox/static/js/iframe-resizer/iframeResizer.min.js b/remarkbox/static/js/iframe-resizer/iframeResizer.min.js index 7fe4b74..68023b7 100644 --- a/remarkbox/static/js/iframe-resizer/iframeResizer.min.js +++ b/remarkbox/static/js/iframe-resizer/iframeResizer.min.js @@ -1,9 +1 @@ -/*! iFrame Resizer (iframeSizer.min.js ) - v3.5.14 - 2017-03-30 - * Desc: Force cross domain iframes to size to content. - * Requires: iframeResizer.contentWindow.min.js to be loaded into the target frame. - * Copyright: (c) 2017 David J. Bradshaw - dave@bradshaw.net - * License: MIT - */ - -!function(a){"use strict";function b(a,b,c){"addEventListener"in window?a.addEventListener(b,c,!1):"attachEvent"in window&&a.attachEvent("on"+b,c)}function c(a,b,c){"removeEventListener"in window?a.removeEventListener(b,c,!1):"detachEvent"in window&&a.detachEvent("on"+b,c)}function d(){var a,b=["moz","webkit","o","ms"];for(a=0;ae&&(e=c,h(V,"Set "+d+" to min value")),e>b&&(e=b,h(V,"Set "+d+" to max value")),U[d]=""+e}function g(){function b(){function a(){var a=0,b=!1;for(h(V,"Checking connection is from allowed list of origins: "+d);aP[x]["max"+a])throw new Error("Value for min"+a+" can not be greater than max"+a)}b("Height"),b("Width"),a("maxHeight"),a("minHeight"),a("maxWidth"),a("minWidth")}function f(){var a=d&&d.id||S.id+F++;return null!==document.getElementById(a)&&(a+=F++),a}function g(a){return R=a,""===a&&(c.id=a=f(),G=(d||{}).log,R=a,h(a,"Added missing iframe ID: "+a+" ("+c.src+")")),a}function i(){switch(h(x,"IFrame scrolling "+(P[x].scrolling?"enabled":"disabled")+" for "+x),c.style.overflow=!1===P[x].scrolling?"hidden":"auto",P[x].scrolling){case!0:c.scrolling="yes";break;case!1:c.scrolling="no";break;default:c.scrolling=P[x].scrolling}}function k(){("number"==typeof P[x].bodyMargin||"0"===P[x].bodyMargin)&&(P[x].bodyMarginV1=P[x].bodyMargin,P[x].bodyMargin=""+P[x].bodyMargin+"px")}function l(){var a=P[x].firstRun,b=P[x].heightCalculationMethod in O;!a&&b&&r({iframe:c,height:0,width:0,type:"init"})}function m(){Function.prototype.bind&&(P[x].iframe.iFrameResizer={close:n.bind(null,P[x].iframe),resize:u.bind(null,"Window resize","resize",P[x].iframe),moveToAnchor:function(a){u("Move to anchor","moveToAnchor:"+a,P[x].iframe,x)},sendMessage:function(a){a=JSON.stringify(a),u("Send Message","message:"+a,P[x].iframe,x)}})}function o(d){function e(){u("iFrame.onload",d,c,a,!0),l()}b(c,"load",e),u("init",d,c,a,!0)}function p(a){if("object"!=typeof a)throw new TypeError("Options is not an object")}function q(a){for(var b in S)S.hasOwnProperty(b)&&(P[x][b]=a.hasOwnProperty(b)?a[b]:S[b])}function s(a){return""===a||"file://"===a?"*":a}function t(a){a=a||{},P[x]={firstRun:!0,iframe:c,remoteHost:c.src.split("/").slice(0,3).join("/")},p(a),q(a),P[x].targetOrigin=!0===P[x].checkOrigin?s(P[x].remoteHost):"*"}function w(){return x in P&&"iFrameResizer"in c}var x=g(c.id);w()?j(x,"Ignored iFrame, already setup."):(t(d),i(),e(),k(),o(v(x)),m())}function x(a,b){null===Q&&(Q=setTimeout(function(){Q=null,a()},b))}function y(){function a(){function a(a){function b(b){return"0px"===P[a].iframe.style[b]}function c(a){return null!==a.offsetParent}c(P[a].iframe)&&(b("height")||b("width"))&&u("Visibility change","resize",P[a].iframe,a)}for(var b in P)a(b)}function b(b){h("window","Mutation observed: "+b[0].target+" "+b[0].type),x(a,16)}function c(){var a=document.querySelector("body"),c={attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0},e=new d(b);e.observe(a,c)}var d=window.MutationObserver||window.WebKitMutationObserver;d&&c()}function z(a){function b(){B("Window "+a,"resize")}h("window","Trigger event: "+a),x(b,16)}function A(){function a(){B("Tab Visable","resize")}"hidden"!==document.visibilityState&&(h("document","Trigger event: Visiblity change"),x(a,16))}function B(a,b){function c(a){return"parent"===P[a].resizeFrom&&P[a].autoResize&&!P[a].firstRun}for(var d in P)c(d)&&u(a,b,document.getElementById(d),d)}function C(){b(window,"message",l),b(window,"resize",function(){z("resize")}),b(document,"visibilitychange",A),b(document,"-webkit-visibilitychange",A),b(window,"focusin",function(){z("focus")}),b(window,"focus",function(){z("focus")})}function D(){function b(a,b){function c(){if(!b.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==b.tagName.toUpperCase())throw new TypeError("Expected