/*
======================================================================
Interface ContentHandler
======================================================================
976395
@Override
	public void startPrefixMapping(String prefix, String uri)
			throws SAXException {
		this.exiAttributes.addNamespaceDeclaration(uri, prefix);
	}
168350
@Override
	public void startContent(ChainWriter out, WebSiteRequest req, HttpServletResponse resp, int[] contentColumnSpans, int preferredWidth) {
		out.print("<table cellpadding='0' cellspacing='0'");
		if(preferredWidth!=-1) out.print(" width='").print(preferredWidth).print('\'');
		out.print(">\n"
				+ "  <tr>\n");
		int totalColumns=0;
		for(int c=0;c<contentColumnSpans.length;c++) {
			if(c>0) totalColumns++;
			totalColumns+=contentColumnSpans[c];
		}
		out.print("    <td");
		if(totalColumns!=1) out.print(" colspan='").print(totalColumns).print('\'');
		out.print("><hr /></td>\n"
				+ "  </tr>\n");
	}
799755
function htmlParserImpl(html, handler) {
    if (html === null || html === undefined) {
      html = '';
    } else if (typeof html !== 'string') {
      html = '' + html;
    }

    var inertBodyElement = getInertBodyElement(html);
    if (!inertBodyElement) return '';

    //mXSS protection
    var mXSSAttempts = 5;
    do {
      if (mXSSAttempts === 0) {
        throw $sanitizeMinErr('uinput', 'Failed to sanitize html because the input is unstable');
      }
      mXSSAttempts--;

      // trigger mXSS if it is going to happen by reading and writing the innerHTML
      html = inertBodyElement.innerHTML;
      inertBodyElement = getInertBodyElement(html);
    } while (html !== inertBodyElement.innerHTML);

    var node = inertBodyElement.firstChild;
    while (node) {
      switch (node.nodeType) {
        case 1: // ELEMENT_NODE
          handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes));
          break;
        case 3: // TEXT NODE
          handler.chars(node.textContent);
          break;
      }

      var nextNode;
      if (!(nextNode = node.firstChild)) {
        if (node.nodeType === 1) {
          handler.end(node.nodeName.toLowerCase());
        }
        nextNode = getNonDescendant('nextSibling', node);
        if (!nextNode) {
          while (nextNode == null) {
            node = getNonDescendant('parentNode', node);
            if (node === inertBodyElement) break;
            nextNode = getNonDescendant('nextSibling', node);
            if (node.nodeType === 1) {
              handler.end(node.nodeName.toLowerCase());
            }
          }
        }
      }
      node = nextNode;
    }

    while ((node = inertBodyElement.firstChild)) {
      inertBodyElement.removeChild(node);
    }
  }
637876
public function doRequestAndParse(RequestHandleInterface $handle, $contentType = 'application/json')
    {
        if($this->isCacheable($handle) && (false !== ($params = $this->cache->fetch('parser_' . $handle->hash()))))
        {
            $parser = new JsonParser;
            $parser->setParams($params);

            return $parser;
        }

        $handle->setHeader('Content-Type', $contentType);
        $handle->setHeader('X-Requested-With', 'XMLHttpRequest');

        $rawResponse = $handle->execute();
        $httpCode    = $handle->getResponseCode();
        $header_size = $handle->getResponseHeaderSize();

        $headers     = substr($rawResponse, 0, $header_size);
        $rawResponse = substr($rawResponse, $header_size);

        if($httpCode < 200 || $httpCode > 299)
        {
            $type      = $handle->getMethod();
            $uri       = $handle->getUrl();
            $exception = new ConnectorException(
                "Error connecting to:
                Uri: $type $uri
                Response code: $httpCode.
                Error: " . substr($rawResponse, 0, 255));
            $exception->setHttpTrace(new HttpTrace($uri, $httpCode, $rawResponse));
            throw $exception;
        }

        $parser = new JsonParser($rawResponse, true);
        //Save response to cache
        if($this->isCacheable($handle))
        {
            $cacheTTL = false;

            //Cache-Control header with max-age
            if(preg_match('/cache\-control\:\s*(private|public),\s*max\-age=([0-9]+)/i', $headers, $matches))
            {
                //Whether it's private or public is in $matches[1]
                $cacheTTL = $matches[2];
            }

            if($cacheTTL)
            {
                $this->cache->save('parser_' . $handle->hash(), $parser->getParams(), $cacheTTL);
            }
        }

        return $parser;
    }
775556
function(fn) {
	/*!
	 * contentloaded.js
	 *
	 * Author: Diego Perini (diego.perini at gmail.com)
	 * Summary: cross-browser wrapper for DOMContentLoaded
	 * Updated: 20101020
	 * License: MIT
	 * Version: 1.2
	 *
	 * URL:
	 * http://javascript.nwbox.com/ContentLoaded/
	 * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
	 *
	 */
	
	// @fn function reference

	var done = false,
		top = true,

		root = y.documentElement,
	
		add = y.attachEvent ? 'attachEvent' : 'addEventListener',
		rem = y.attachEvent ? 'detachEvent' : 'removeEventListener',
		pre = y.attachEvent ? 'on' : '',
	
		init = function(e) {
			if (e.type == 'readystatechange' && y.readyState != 'complete') return;
			(e.type == 'load' ? z : y)[rem](pre + e.type, init, false);
			if (!done && (done = true)) fn.call(z, e.type || e);
		},
	
		poll = function() {
			try { 
				if(!root.doScroll('left')){ 
					setTimeout(poll, 50); return;
				} 
			} catch(e) { setTimeout(poll, 50); return; }
			init('poll');
		};

	if (y.readyState == 'complete') fn.call(z, 'lazy');
	else {
		if (y.createEventObject && root.doScroll) {
			try { top = !z.frameElement; } catch(e) { }
			if (top) poll();
		}
		y[add](pre + 'DOMContentLoaded', init, false);
		y[add](pre + 'readystatechange', init, false);
		z[add](pre + 'load', init, false);
	}
}
736340
function () {
            if (!this._pageConfigHelper) {
                return;
            }
            var lazyPlaceholders = this._pageConfigHelper.getLazyPlaceholdersIds();
            this._lazyContent = false;
            this.$raiseEvent({
                name : "contentChange",
                contentPaths : lazyPlaceholders
            });

            this._pageConfigHelper.$dispose();
        }
1073024
@Override
	protected void renderContent(HttpServletRequest req, HttpServletResponse res)
			throws ServletException, IOException {
		log.trace("renderContent");

		Map<String, String> pageProps = new HashMap<String, String>();
		pageProps.put("message", "");
		pageProps.put("searchAllChecked", "");
		pageProps.put("resourceType", "");

		ComponentBindingsProviderFactoryImpl factoryImpl = (ComponentBindingsProviderFactoryImpl) factory;

		if ("true".equals(req.getParameter("reloadCache"))) {
			factoryImpl.reloadCache();
			pageProps.put("message", "Cache Reloaded");
		}
		List<ServiceReference> bindingProviders = new ArrayList<ServiceReference>();
		String resourceType = req.getParameter("resourceType");
		if (!StringUtils.isEmpty(resourceType)) {
			log.debug("Searching for resource type: {}", resourceType);
			pageProps.put("resourceType", resourceType);
			bindingProviders = factoryImpl.getReferences(req
					.getParameter("resourceType"));
		} else if ("true".equals(req.getParameter("searchAll"))) {
			pageProps.put("searchAllChecked", "checked");
			log.debug("Searching for all binding providers");
			for (String rt : factoryImpl.getLoadedResourceTypes()) {
				log.debug("Searching for resource type: {}", rt);
				for (ServiceReference reference : factoryImpl.getReferences(rt)) {
					if (!bindingProviders.contains(reference)) {
						bindingProviders.add(reference);
					}
				}
			}
		}

		renderBlock(res, "header.html", pageProps);
		renderBlock(res, "search.html", pageProps);

		for (int i = 0; i < bindingProviders.size(); i++) {
			Map<String, String> properties = loadProperties(bindingProviders
					.get(i));
			properties.put("state", (i + 1) % 2 == 0 ? "even" : "odd");
			renderBlock(res, "result.html", properties);
		}
		res.getWriter().write("</tbody></table>");

		res.getWriter()
				.write("<table><tr><th class=\"content ui-state-default\">Recent Exceptions</th></tr>");

		for (final Object obj : componentBindingsValuesProvider
				.getRecentExceptions()) {
			renderBlock(res, "exception.html", new HashMap<String, String>() {
				private static final long serialVersionUID = 1L;
				{
					put("ex", obj.toString());
				}
			});
		}
		res.getWriter().write("</table>");
	}
929882
function resolve(contentEl) {
        router.allowPageChange = true;
        if (!contentEl) { return; }
        if (typeof contentEl === 'string') {
          $newTabEl.html(contentEl);
        } else {
          $newTabEl.html('');
          if (contentEl.f7Component) {
            contentEl.f7Component.$mount(function (componentEl) {
              $newTabEl.append(componentEl);
            });
          } else {
            $newTabEl.append(contentEl);
          }
        }
        $newTabEl[0].f7RouterTabLoaded = true;
        onTabLoaded(contentEl);
      }
301820
function handleContent(element, spaces, marker) {
  let renderedContent = '';
  let objectLike = null;

  if (element.content === undefined) {
    return [renderedContent, objectLike];
  }

  for (const item of element.content) {
    // Note: the `initialIndent` option above works because we specifically
    //       do *not* pass it down the rabbit hole here.
    if (item.element === 'member') {
      // This is an object type or something similar.
      objectLike = true;
      /* eslint-disable no-use-before-define */
      renderedContent += handle(item.key.content, item.value, {
        parent: element,
        spaces,
        marker,
        attributesElement: item,
      });
      /* eslint-enable no-use-before-define */
    } else if (item.element === 'ref') {
      renderedContent += `${marker} Include ${item.content.href}\n`;
    } else if (item.element === 'select') {
      // This is a `OneOf` mutually exclusive type. Currently not
      // supported as it needs some support upstream in Minim.
      console.warn('MSON select/option elements are not yet supported!');
    } else {
      // This is an array type or something similar.
      objectLike = false;
      /* eslint-disable no-use-before-define */
      renderedContent += handle(item.title, item, {
        parent: element,
        spaces,
        marker,
      });
      /* eslint-enable no-use-before-define */
    }
  }

  return [renderedContent, objectLike];
}
1216651
function addHandler(node, eventType, handler, thisObject){
    node = getNode(node);

    if (!node)
      throw 'basis.event.addHandler: can\'t attach event listener to undefined';

    if (typeof handler != 'function')
      throw 'basis.event.addHandler: handler is not a function';

    var handlers = node === global ? globalEvents : node[EVENT_HOLDER];

    if (!handlers)
      handlers = node[EVENT_HOLDER] = {};

    var eventTypeHandlers = handlers[eventType];
    var handlerObject = {
      handler: handler,
      thisObject: thisObject
    };

    if (!eventTypeHandlers)
    {
      eventTypeHandlers = handlers[eventType] = [handlerObject];
      eventTypeHandlers.fireEvent = function(event){ // closure
        // simulate capture phase for old browsers
        event = wrap(event);
        if (noCaptureScheme && event && globalHandlers[eventType])
        {
          if (typeof event.returnValue == 'undefined')
          {
            observeGlobalEvents(event);
            if (event.cancelBubble === true)
              return;
            if (typeof event.returnValue == 'undefined')
              event.returnValue = true;
          }
        }

        startFrame(event);

        // call eventType handlers
        for (var i = 0, wrappedEvent = new Event(event), item; item = eventTypeHandlers[i++];)
          item.handler.call(item.thisObject, wrappedEvent);

        finishFrame(event);
      };

      if (W3CSUPPORT)
        // W3C DOM event model
        node.addEventListener(eventType, eventTypeHandlers.fireEvent, false);
      else
        // old IE event model
        node.attachEvent('on' + eventType, eventTypeHandlers.fireEvent);
    }
    else
    {
      // check for duplicates, exit if found
      for (var i = 0, item; item = eventTypeHandlers[i]; i++)
        if (item.handler === handler && item.thisObject === thisObject)
          return;

      // add only unique handlers
      eventTypeHandlers.push(handlerObject);
    }
  }
180289
public function onContent(ContentEvent $event)
    {
        $content = null;
        $event->clearModules();
        $this->start('precontent_module');
        $this->eventDispatcher->dispatch('edemy_precontent_module', $event);
        var_dump('preContentModule: ' . $this->stop('precontent_module')->getDuration());

        $this->start('routeContent');
        $this->eventDispatcher->dispatch($event->getRoute(), $event);
        var_dump('routeContent ' . $event->getRoute() . ': ' . $this->stop('routeContent')->getDuration());

        //die(var_dump($event));
        if($event->isPropagationStopped()) {

            return false;
        }
        $this->start('postcontent_module');
        $this->eventDispatcher->dispatch('edemy_postcontent_module', $event);
        var_dump('postContentModule: ' . $this->stop('postcontent_module')->getDuration());
        $event->setContent(
            $this->render("snippets/join", array(
                'modules' => $event->getModules()
            ))
        );

        return true;
    }
428989
@Override
    protected void initContent() {

        if (CmsStringUtil.isNotEmpty(getParamContent())) {
            if (CmsStringUtil.isNotEmpty(getParamElementname())
                && getParamElementname().equals(getParamOldelementname())) {
                if (CmsStringUtil.isNotEmpty(getParamElementlanguage())
                    && getParamElementlanguage().equals(getParamOldelementlanguage())) {
                    return;
                }
            }
        }
        getCms().getRequestContext().setAttribute(CmsRequestContext.ATTRIBUTE_EDITOR, Boolean.TRUE);

        String elementData;
        if (m_page.hasValue(getParamElementname(), getElementLocale())) {
            // element value is available in the page
            elementData = m_page.getStringValue(getCms(), getParamElementname(), getElementLocale());
        } else {
            // value is not available in the page
            if (Boolean.valueOf(getParamDirectedit()).booleanValue()) {
                // direct edit on a non-existing element: create new element with this name
                m_page.addValue(getParamElementname(), getElementLocale());
            }
            elementData = "";
        }
        setParamContent(elementData);
    }
845388
protected function set_content_handler($handler)
	{
		$this->handler_object = null;
		$this->content_handler = (string) $handler;
		return $this;
	}
12107
function(content){
			if (typeof content === 'string') {  //$NON-NLS-0$
				this._contentParent.innerHTML = content;
			} else {
				this._contentParent.innerHTML = ""; //NON-NLS-0$
				this._contentParent.appendChild(content);
			}
		}
1204273
function openContentWindow() {
         var settings = {
            resizable: 'yes',
            scrollbars: 'yes',
            status: 'yes',
            width: 1280,
            height: 700
         };

         var settingsString = Object.keys( settings ).map( function( key ) {
            return '' + key + '=' + settings[ key ];
         } ).join( ',' );

         if( !contentWindow || contentWindow.closed ) {
            contentWindow = window.open( contentBundle.index, 'axDeveloperTools', settingsString );
         }

         try {
            contentWindow.focus();
         }
         catch( e ) {
            log.warn(
               'Laxar-developer-tools-widget: Popup was blocked.' +
               ' Unblock in browser, or use the "button" feature.'
            );
         }
      }
233751
function pongLayoutEditorDivHTML( divId, resourceURL, paramObj ) {
	log( "layout-editor",  "divId="+divId+" resourceURL="+resourceURL );
	if ( moduleConfig[ divId ] != null ) {
		var cnf = moduleConfig[ divId ].layout;
		moduleConfig[ divId ].resourceURL = resourceURL;
		moduleConfig[ divId ].page_id = -1;
		var contentItems = [];
		contentItems.push( '<div id="'+divId+'Inner" style="width:100%;height:100%">' );
		contentItems.push( '</div>' );
		contentItems.push( '<div class="layoutEditorZoom"><form><select id="'+divId+'ZoomSel">' );
		contentItems.push( '<option value="1.0">100%</option>' );
		contentItems.push( '<option value="0.8">80%</option>' );
		contentItems.push( '<option value="0.6">60%</option>' );
		contentItems.push( '<option value="0.5">50%</option>' );
		contentItems.push( '<option value="0.4" selected="selected">40%</option>' );
		contentItems.push( '<option value="0.3">30%</option>' );
		contentItems.push( '<option value="0.2">20%</option>' );
		contentItems.push( '</select></div>' );
		contentItems.push( '<script>' );
		contentItems.push( '$(function() { ' );
		contentItems.push( '    $( "#'+divId+'ZoomSel" ).change( ' );
		contentItems.push( '       function( event ) { ' );
		contentItems.push( '           udateModuleData( "'+divId+'", '+JSON.stringify(paramObj)+' ); ' );
		contentItems.push( '          return false;  ' );
		contentItems.push( '       }' );
		contentItems.push( '     );  ' );
		contentItems.push( ' }); ' );
		contentItems.push( '</script>' );
		$( "#"+divId ).html( contentItems.join( "\n" ) );
		pongLayoutEditorRenderHTML( divId, resourceURL, paramObj, cnf );				
	} else {
		$( "#"+divId ).html( '<div id="'+divId+'layout-editor_Div" class="layout-editor">ERROR [1]</div>' );
    publishEvent( 'feedback', {'text':'Error: Layout config required!'} )
	}
}
932259
function init ($container, elementSelector, eventSelectors, handler) {
      $container = $container || $(document.body)

      // Handle control clicks
      function deferred () {
        var $control = $(this)
        handler($control, getToggledContent($control))
      }

      // Prepare ARIA attributes
      var $controls = $(elementSelector)
      $controls.each(initToggledContent)

      // Handle events
      $.each(eventSelectors, function (idx, eventSelector) {
        $container.on('click.' + selectors.namespace, eventSelector, deferred)
      })

      // Any already :checked on init?
      if ($controls.is(':checked')) {
        $controls.filter(':checked').each(deferred)
      }
    }