This is an automated email from the ASF dual-hosted git repository.

aharui pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git

commit 192a644942303b57a4807ba22dadd9dbca576500
Author: Alex Harui <aha...@apache.org>
AuthorDate: Fri Feb 23 21:41:09 2018 -0800

    new beads to try to get search indexing to work
---
 .../Basic/src/main/resources/basic-manifest.xml    |  3 +
 .../apache/royale/routing/EscapedFragmentBead.as   | 95 ++++++++++++++++++++++
 .../routing/HashChangeNotifierBeadWithTitle.as     | 69 ++++++++++++++++
 .../org/apache/royale/routing/URLParameterBead.as  | 90 ++++++++++++++++++++
 4 files changed, 257 insertions(+)

diff --git a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml 
b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
index fb4429d..acc6606 100644
--- a/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
+++ b/frameworks/projects/Basic/src/main/resources/basic-manifest.xml
@@ -214,5 +214,8 @@
     <component id="TreeGridColumn" 
class="org.apache.royale.html.supportClasses.TreeGridColumn" />
 
     <component id="HashChangeNotifierBead" 
class="org.apache.royale.routing.HashChangeNotifierBead" />
+    <component id="HashChangeNotifierBeadWithTitle" 
class="org.apache.royale.routing.HashChangeNotifierBeadWithTitle" />
+    <component id="URLParameterBead" 
class="org.apache.royale.routing.URLParameterBead" />
+    <component id="EscapedFragmentBead" 
class="org.apache.royale.routing.EscapedFragmentBead" />
 
 </componentPackage>
diff --git 
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/EscapedFragmentBead.as
 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/EscapedFragmentBead.as
new file mode 100644
index 0000000..be22d5f
--- /dev/null
+++ 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/EscapedFragmentBead.as
@@ -0,0 +1,95 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.routing
+{
+    import org.apache.royale.core.IStrand;
+    import org.apache.royale.events.Event;
+       
+       /**
+        *  The EscapedFragmentBead class handles a special URL parameter that
+     *  Google Search Crawlers use to verify search results.  This
+     *  technique is deprecated so use of this bead should be
+     *  obsolete by 2nd quarter 2018.
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.9
+        */
+
+       public class EscapedFragmentBead extends URLParameterBead
+       {
+               /**
+                *  constructor.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9
+                */
+               public function EscapedFragmentBead()
+               {
+               }
+               
+        // supposedly, Google's crawler sends a hash bang fragment with this
+        // as the url param to verify that the page really did want the
+        // hash bang fragment indexed.  If the contents returned is the same
+        // as the hash bang then the page is indexed.
+        // 
https://webmasters.googleblog.com/2017/12/rendering-ajax-crawling-pages.html
+        private static const token:String = "?_escaped_fragment_="
+            
+               /**
+                *  @copy org.apache.royale.core.IBead#strand
+                *  
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9
+                */
+               override public function set strand(value:IStrand):void
+               {       
+                       _strand = value;
+            COMPILE::JS
+            {
+                if (location.search.indexOf(token) != -1)
+                    dispatchEvent(new Event("ready"));
+            }
+            COMPILE::SWF
+            {
+                //TODO (aharui) SWF impl
+            }
+               }
+               
+               override public function get urlParameters():String
+               {
+                       COMPILE::JS
+                       {
+                               var s:String = location.search;
+                var c:int = s.indexOf(token);
+                if (c != -1)
+                    s = s.substring(c + token.length);
+                return s;
+                       }
+                       COMPILE::SWF
+                       {
+                               return null; //TODO (aharui) SWF impl
+                       }
+               }               
+       }
+}
diff --git 
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/HashChangeNotifierBeadWithTitle.as
 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/HashChangeNotifierBeadWithTitle.as
new file mode 100644
index 0000000..fdcd8be
--- /dev/null
+++ 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/HashChangeNotifierBeadWithTitle.as
@@ -0,0 +1,69 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.routing
+{
+       /**
+        *  The HashChangeNotifierBead class allows you to respond to the hash 
changing on the url.
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.9
+        */
+
+       public class HashChangeNotifierBeadWithTitle extends 
HashChangeNotifierBead
+       {
+               /**
+                *  constructor.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9
+                */
+               public function HashChangeNotifierBeadWithTitle()
+               {
+               }
+               
+               
+               public function get title():String
+               {
+                       COMPILE::JS
+                       {
+                               return document.title;
+                       }
+                       COMPILE::SWF
+                       {
+                               return null; //TODO (aharui) SWF impl
+                       }
+               }
+        public function set title(value:String):void
+        {
+            COMPILE::JS
+            {
+                document.title = value;
+            }
+            COMPILE::SWF
+            {
+                //TODO (aharui) SWF impl
+            }
+        }
+               
+       }
+}
diff --git 
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/URLParameterBead.as
 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/URLParameterBead.as
new file mode 100644
index 0000000..f6b5495
--- /dev/null
+++ 
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/URLParameterBead.as
@@ -0,0 +1,90 @@
+////////////////////////////////////////////////////////////////////////////////
+//
+//  Licensed to the Apache Software Foundation (ASF) under one or more
+//  contributor license agreements.  See the NOTICE file distributed with
+//  this work for additional information regarding copyright ownership.
+//  The ASF licenses this file to You under the Apache License, Version 2.0
+//  (the "License"); you may not use this file except in compliance with
+//  the License.  You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+//  Unless required by applicable law or agreed to in writing, software
+//  distributed under the License is distributed on an "AS IS" BASIS,
+//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//  See the License for the specific language governing permissions and
+//  limitations under the License.
+//
+////////////////////////////////////////////////////////////////////////////////
+package org.apache.royale.routing
+{
+       
+       import org.apache.royale.core.IBead;
+       import org.apache.royale.core.IStrand;
+       import org.apache.royale.events.Event;
+       import org.apache.royale.events.IEventDispatcher;
+       import org.apache.royale.events.EventDispatcher;
+
+       /**
+     *  Dispatched when the application has started
+     *
+     *  @langversion 3.0
+     *  @playerversion Flash 10.2
+     *  @playerversion AIR 2.6
+     *  @productversion Royale 0.9
+     */
+    [Event(name="ready", type="org.apache.royale.events.Event")]
+    
+       /**
+        *  The URLParameterBead class dispatches an event at startup when
+     *  the URL parameters are ready to be processed.
+        *  
+        *  @langversion 3.0
+        *  @playerversion Flash 10.2
+        *  @playerversion AIR 2.6
+        *  @productversion Royale 0.9
+        */
+
+       public class URLParameterBead extends EventDispatcher implements IBead
+       {
+               /**
+                *  constructor.
+                *
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9
+                */
+               public function URLParameterBead()
+               {
+               }
+               
+               protected var _strand:IStrand;
+               
+               /**
+                *  @copy org.apache.royale.core.IBead#strand
+                *  
+                *  @langversion 3.0
+                *  @playerversion Flash 10.2
+                *  @playerversion AIR 2.6
+                *  @productversion Royale 0.9
+                */
+               public function set strand(value:IStrand):void
+               {       
+                       _strand = value;
+            dispatchEvent(new Event("ready"));
+               }
+               
+               public function get urlParameters():String
+               {
+                       COMPILE::JS
+                       {
+                               return location.search;
+                       }
+                       COMPILE::SWF
+                       {
+                               return null; //TODO (aharui) SWF impl
+                       }
+               }               
+       }
+}

-- 
To stop receiving notification emails like this one, please contact
aha...@apache.org.

Reply via email to