embedding_redirection_js

NAML documentation   Watch a video
   Usages of this macro
... in app.naml
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<macro name="embedding_redirection_js">
    <n.node_parameter_or_root
Macro
Parameters: do
.>
        <n.if
Binary
Namespace: BasicNamespace
Parameters: condition, else, then
.has_embedding_redirection_url
Binary
Namespace: NodeNamespace
>
            <then>
                <script type="text/javascript">
                    var embeddedUrl = '<n.embedding_redirection_url
Binary
Namespace: NodeNamespace
/>';
                    var botPattern = "(googlebot\/|Googlebot-Mobile|Googlebot-Image|Google favicon|Mediapartners-Google|bingbot|slurp|java|wget|curl|Commons-HttpClient|Python-urllib|libwww|httpunit|nutch|phpcrawl|msnbot|jyxobot|FAST-WebCrawler|FAST Enterprise Crawler|biglotron|teoma|convera|seekbot|gigablast|exabot|ngbot|ia_archiver|GingerCrawler|webmon |httrack|webcrawler|grub.org|UsineNouvelleCrawler|antibot|netresearchserver|speedy|fluffy|bibnum.bnf|findlink|msrbot|panscient|yacybot|AISearchBot|IOI|ips-agent|tagoobot|MJ12bot|dotbot|woriobot|yanga|buzzbot|mlbot|yandexbot|purebot|Linguee Bot|Voyager|CyberPatrol|voilabot|baiduspider|citeseerxbot|spbot|twengabot|postrank|turnitinbot|scribdbot|page2rss|sitebot|linkdex|Adidxbot|blekkobot|ezooms|dotbot|Mail.RU_Bot|discobot|heritrix|findthatfile|europarchive.org|NerdByNature.Bot|sistrix crawler|ahrefsbot|Aboundex|domaincrawler|wbsearchbot|summify|ccbot|edisterbot|seznambot|ec2linkfinder|gslfbot|aihitbot|intelium_bot|facebookexternalhit|yeti|RetrevoPageAnalyzer|lb-spider|sogou|lssbot|careerbot|wotbox|wocbot|ichiro|DuckDuckBot|lssrocketcrawler|drupact|webcompanycrawler|acoonbot|openindexspider|gnam gnam spider|web-archive-net.com.bot|backlinkcrawler|coccoc|integromedb|content crawler spider|toplistbot|seokicks-robot|it2media-domain-crawler|ip-web-crawler.com|siteexplorer.info|elisabot|proximic|changedetection|blexbot|arabot|WeSEE:Search|niki-bot|CrystalSemanticsBot|rogerbot|360Spider|psbot|InterfaxScanBot|Lipperhey SEO Service|CC Metadata Scaper|g00g1e.net|GrapeshotCrawler|urlappendbot|brainobot|fr-crawler|binlar|SimpleCrawler|Livelapbot|Twitterbot|cXensebot|smtbot|bnf.fr_bot|A6-Indexer|ADmantX|Facebot|Twitterbot|OrangeBot|memorybot|AdvBot|MegaIndex|SemanticScholarBot|ltx71|nerdybot|xovibot|BUbiNG|Qwantify|archive.org_bot|Applebot|TweetmemeBot|crawler4j|findxbot|SemrushBot|yoozBot|lipperhey|y!j-asr|Domain Re-Animator Bot|AddThis)";
                    var re = new RegExp(botPattern, 'i');
                    if( !Nabble.isEmbedded && !re.test(navigator.userAgent) ) { 
                        var url = top.location.href;
                        
                        var posHtml = url.lastIndexOf('.html');
                        var c = '-';
                        var hash;
                        if (url.indexOf('?') == -1 && posHtml > 0) {
                            var posStart = url.lastIndexOf('-');
                            hash = (posStart > 0)? url.substring(posStart+1, posHtml):'';
                        } else {
                            hash = url.replace(new RegExp('https?://'), '');
                            hash = hash.substring(hash.indexOf('/')+1);
                            hash = hash;
                            c = '+';
                        }
                        if (Nabble.analytics) Nabble.analytics();
                        var _hash = hash.length==1?'':'#nabble' + c + encodeURIComponent(hash);
 
                        if (top.location.hash) {
                            var realHash = top.location.hash.substring(1);
                            _hash += '|' + encodeURIComponent(realHash);
                        }
                        _hash = _hash.length == 8 ? '' : _hash;
                        top.location.replace(embeddedUrl + _hash);
                    }
                </script>
            </then>
        </n.if.has_embedding_redirection_url>
    </n.node_parameter_or_root.>
</macro>