This text has not been reviewed by Odyssey HQ and solely displays the concepts and opinions of the creator.
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
window.REBELMOUSE_STDLIB.loadExternalScript(“https://cdn.optmn.cloud/hb/rebelmousecom-adapter.js”, function() {
});
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
var scope = {};
var $searchButton = document.querySelector(‘.search-bar-container .open-search-bar’),
$closeButton = document.querySelector(‘.search-bar-container .close-search-bar’),
$searchBarContainer = document.querySelector(‘.search-bar-container’),
$searchInput = document.querySelector(‘.search-bar-container .search-widget__input’),
$searchForm = document.querySelector(‘.search-bar-container form’);
$searchButton.addEventListener(‘click’, function(e){
e.preventDefault();
$searchBarContainer.classList.add(‘active’);
$closeButton.style.display = ‘block’;
$searchButton.style.display = ‘none’;
});
$closeButton.addEventListener(‘click’, function(e){
e.preventDefault();
$searchBarContainer.classList.remove(‘active’);
$searchButton.style.display = ‘block’;
$closeButton.style.display = ‘none’;
});
$searchInput.addEventListener(‘keydown’, function (e) {
if (e.code === 13) {
$searchForm.submit();
return false;
}
});
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
var formToJSON = function(form){
var fData = new FormData(form);
var obj = {};
fData.forEach(function(value, key){
obj[key] = value;
});
return obj;
};
var objectToQueryString = function(params){
return Object.keys(params).map(function(key){return encodeURIComponent(key) + ‘=’ + encodeURIComponent(params[key])}).join(‘&’);
};
var isEmail = function(email){
var regex = /^([a-zA-Z0-9_.+-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
return regex.test(email);
};
var register = function(form){
let url = form.action;
let options = {};
let body = formToJSON(form);
url = url.replace(/?$/, ”) + “newslettercb&” + objectToQueryString(body);
if(!(‘newslettercb’ in window)){
window.newslettercb = function(data){
let failureElement = form.querySelector(‘.newsletter-failure’);
if (data.result !== “success”) {
console.log(‘error: ‘ + data.msg);
if ((data.msg.match(“Click here to update your profile.$”)) || (data.msg.match(“^Recipient”))) {
failureElement.innerText(‘You are already subscribed.’);
failureElement.classList.remove(‘hidden’);
}
return;
}
form.querySelector(‘.newsletter-failure’).classList.add(‘hidden’);
form.querySelector(‘#newsletter-email’).classList.add(‘hidden’);
form.querySelector(‘#newsletter-submit-button’).classList.add(‘hidden’);
form.querySelector(‘.newsletter-success’).classList.remove(‘hidden’);
}
}
let script = document.createElement(“script”);
script.src = url;
script.async = true;
document.head.appendChild(script);
};
var onButtonClick = function(event){
event.preventDefault();
let form = this.closest(‘form’);
let inputField = form.querySelector(‘#newsletter-email’);
var enteredEmail = inputField.value;
if ( isEmail(enteredEmail) ) {
register(form);
} else {
form.querySelector(‘.newsletter-failure’).classList.remove(‘hidden’);
}
};
document.querySelectorAll(‘form.newsletter’).forEach(function(form){
let button = form.querySelector(‘[type=”submit”]’);
if(!button)
return;
console.log(“scope1”, form);
button.addEventListener(‘click’, onButtonClick);
});
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
let parag = document.querySelectorAll(‘.post-bottom .body-description p’);
parag.forEach((item, index) => {
if(index == 2){
let parent = item.parentNode;
let disDiv = document.createElement(“div”);
disDiv.classList.add(“distroscale_p2”);
disDiv.style.height = “330px”;
disDiv.style.width = “100%”;
parent.insertBefore(disDiv, item);
}
})
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
document.querySelectorAll(“.viewport-css-anchor”).forEach(function(element){
if(window.scrollY < (element.offsetTop + element.offsetHeight)) return;
var style = element.getAttribute('data-id');
document.getElementById(style).setAttribute('media', 'screen');
});
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
window.REBELMOUSE_STDLIB.loadExternalScript("//js.hsforms.net/forms/v2.js", function() {
hbspt.forms.create({
portalId: "4526177",
target: '#hubspot-form',
formId: "6b1e50fe-b7ee-440b-8a34-d0f42a900ac9"
});
});
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
REBELMOUSE_STDLIB.onElementInViewport({
threshold: 400,
selector: ".sidebar_sticky_parent",
oneTime: true,
onIntersect: function(entry){
var element = entry.target;
var ad_el=element.querySelector(".sidebar_repeat_ad");
ad_el .classList.add("rblad-sidebar_3");
element.insertAdjacentHTML(
"afterend",
'
‘
);
}
});
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
window.REBELMOUSE_STDLIB.loadExternalScript(“https://connect.facebook.net/en_US/sdk.js”, function() {
});
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
window.fbAsyncInit = function() {
FB.init({
appId : ‘REBELMOUSE_BOOTSTRAP_DATA’ in window ? window.REBELMOUSE_BOOTSTRAP_DATA.fbID : “402984699895135”,
autoLogAppEvents : true,
xfbml : true,
version : ‘REBELMOUSE_BOOTSTRAP_DATA’ in window ? window.REBELMOUSE_BOOTSTRAP_DATA.fbAppVersion : “v2.5″
});
};
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
/*!
* clipboard.js v1.5.3
* https://zenorocha.github.io/clipboard.js
*
* Licensed MIT © Zeno Rocha
*/
!function(t){;{var e;e=”undefined”!=typeof window?window:”undefined”!=typeof global?global:”undefined”!=typeof self?self:this,e.Clipboard=t()}}(function(){var t,e,n;return function t(e,n,r){function o(a,c){if(!n[a]){if(!e[a]){var s=”function”==typeof require&&require;if(!c&&s)return s(a,!0);if(i)return i(a,!0);var u=new Error(“Cannot find module ‘”+a+”‘”);throw u.code=”MODULE_NOT_FOUND”,u}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i=”function”==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(t,e,n){var r=t("matches-selector");e.exports=function(t,e,n){for(var o=n?t:t.parentNode;o&&o!==document;){if(r(o,e))return o;o=o.parentNode}}},{"matches-selector":2}],2:[function(t,e,n){function r(t,e){if(i)return i.call(t,e);for(var n=t.parentNode.querySelectorAll(e),r=0;rr;r++)n[r].fn.apply(n[r].ctx,e);return this},off:function(t,e){var n=this.e||(this.e={}),r=n[t],o=[];if(r&&e)for(var i=0,a=r.length;a>i;i++)r[i].fn!==e&&r[i].fn._!==e&&o.push(r[i]);return o.length?n[t]=o:delete n[t],this}},e.exports=r},{}],8:[function(t,e,n){“use strict”;function r(t){return t&&t.__esModule?t:{“default”:t}}function o(t,e){if(!(t instanceof e))throw new TypeError(“Cannot call a class as a function”)}n.__esModule=!0;var i=function(){function t(t,e){for(var n=0;n<e.length;n++)!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t("select"),c=r(a),s=function(){function t(e){o(this,t),this.resolveOptions(e),this.initSelection()}return t.prototype.resolveOptions=function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.action=e.action,this.emitter=e.emitter,this.target=e.target,this.text=e.text,this.trigger=e.trigger,this.selectedText=""},t.prototype.initSelection=function t(){if(this.text&&this.target)throw new Error('Multiple attributes declared, use either "target" or "text"');if(this.text)this.selectFake();else{if(!this.target)throw new Error('Missing required attributes, use either "target" or "text"');this.selectTarget()}},t.prototype.selectFake=function t(){var e=this;this.removeFake(),this.fakeHandler=document.body.addEventListener("click",function(){return e.removeFake()}),this.fakeElem=document.createElement("textarea"),this.fakeElem.style.position="absolute",this.fakeElem.style.left="-9999px",this.fakeElem.style.top=(window.pageYOffset||document.documentElement.scrollTop)+"px",this.fakeElem.setAttribute("readonly",""),this.fakeElem.value=this.text,document.body.appendChild(this.fakeElem),this.selectedText=c.default(this.fakeElem),this.copyText()},t.prototype.removeFake=function t(){this.fakeHandler&&(document.body.removeEventListener("click"),this.fakeHandler=null),this.fakeElem&&(document.body.removeChild(this.fakeElem),this.fakeElem=null)},t.prototype.selectTarget=function t(){this.selectedText=c.default(this.target),this.copyText()},t.prototype.copyText=function t(){var e=void 0;try{e=document.execCommand(this.action)}catch(n){e=!1}this.handleResult(e)},t.prototype.handleResult=function t(e){e?this.emitter.emit("success",{action:this.action,text:this.selectedText,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)}):this.emitter.emit("error",{action:this.action,trigger:this.trigger,clearSelection:this.clearSelection.bind(this)})},t.prototype.clearSelection=function t(){this.target&&this.target.blur(),window.getSelection().removeAllRanges()},t.prototype.destroy=function t(){this.removeFake()},i(t,[{key:"action",set:function t()void 0===arguments[0]?"copy":arguments[0];if(this._action=e,"copy"!==this._action&&"cut"!==this._action)throw new Error('Invalid "action" value, use either "copy" or "cut"'),get:function t(){return this._action}},{key:"target",set:function t(e){if(void 0!==e)"object"!=typeof e},get:function t(){return this._target}}]),t}();n.default=s,e.exports=n.default},{select:6}],9:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function a(t,e){var n="data-clipboard-"+t;if(e.hasAttribute(n))return e.getAttribute(n)}n.__esModule=!0;var c=t("./clipboard-action"),s=r(c),u=t("tiny-emitter"),l=r(u),f=t("good-listener"),d=r(f),h=function(t){function e(n,r){o(this,e),t.call(this),this.resolveOptions(r),this.listenClick(n)}return i(e,t),e.prototype.resolveOptions=function t(){var e=arguments.length((Math.log10(n)/3|0)==0)?n:Number((n/Math.pow(10,(Math.log10(n)/3|0)*3)).toFixed(1))+[“”,”k”,”M”,”B”,”T”,][Math.log10(n)/3|0];
var _postViewsElem = document.querySelector(‘.page-views’);
if (_postViewsElem!==null){
var _postViews = parseInt(_postViewsElem.textContent);
_postViewsElem.textContent = beautifyViews(_postViews);
}
var clipboard = new Clipboard(‘.js–copytext’),
animationClass=”button–copytext-animation”,
timer;
clipboard.on(‘success’, function(event) {
var $btn = event.trigger;
$btn.classList.remove(animationClass);
void event.trigger.offsetWidth; // see https://css-tricks.com/restart-css-animation/#article-header-id-0
$btn.classList.add(animationClass);
clearTimeout(timer);
timer = setTimeout(function(){
$btn.classList.remove(animationClass);
},1500);
console.info(“Copied text to clipboard: ” + event.text);
});
var tagNameItem = document.querySelector(‘.post-partial .article-primary-tag’);
if (tagNameItem) {
var tagNameValue = tagNameItem.innerHTML;
if (tagNameValue.indexOf(‘-‘)) {
tagNameItem.innerHTML = tagNameValue.split(‘-‘).join(‘ ‘);
tagNameItem.classList.remove(“hidden”);
}
}
});
window.REBELMOUSE_LOWEST_TASKS_QUEUE.push(function(){
var sendGAevent = function(gaFields) {
console.log(‘New Event Tracked’, gaFields);
window.ga(‘send’, gaFields);
window.ga(‘b.send’, gaFields);
}
var trackClick = function(e){
var $t = e.target,
url = $t.getAttribute(‘data-url’) || false,
eCategory = $t.getAttribute(‘data-event-category’),
eAction = $t.getAttribute(‘data-event-action’),
eLabel = $t.getAttribute(‘data-event-label’),
eValue = $t.getAttribute(‘data-event-value’),
eDimension = $t.getAttribute(‘data-event-dimension’),
eDimensionValue = $t.getAttribute(‘data-event-dimension-value’) || $t.closest(‘[data-dimension-value]’).attr(‘data-dimension-value’) || ”,
gaFields;
// open popup window for share buttons
url && Sharer.openPopupWindow(url);
// GA formatted event data
if (eCategory === ‘social’) {
gaFields = {
hitType: ‘social’,
socialNetwork: eAction,
socialAction: eLabel,
socialTarget: eValue
};
} else {
gaFields = {
hitType: ‘event’,
eventCategory: eCategory,
eventAction: eAction,
eventLabel: eLabel,
eventValue: eValue
};
}
// Set dimension, if any
if( eDimension && eDimensionValue ){
gaFields[eDimension] = decodeURIComponent(eDimensionValue);
}
sendGAevent(gaFields);
};
var handlerJSGATRACKelement = function(element){
element.addEventListener(‘click’, trackClick);
};
document.querySelectorAll(‘.js-ga-track’).forEach(handlerJSGATRACKelement);
if(window.REBELMOUSE_STDLIB != undefined) {
window.REBELMOUSE_STDLIB.createElementChangeListener(‘.js-ga-track’, handlerJSGATRACKelement);
}
var sendFBEvents = function(){
if(!(“FB” in window)) return;
window.FB.Event.subscribe(‘edge.create’, function(url, html_element) {
if( html_element.classList.contains(‘.js–track-likes’) ) {
sendGAevent({
hitType: ‘event’,
eventCategory: ‘social’,
eventAction: ‘Facebook’,
eventLabel: ‘like-odyssey’,
eventValue: window.location.href,
dimension17: ‘Like Odyssey on Facebook (Article Page)’
});
}
});
window.FB.Event.subscribe(‘edge.remove’, function(url, html_element) {
if( html_element.classList.contains(‘.js–track-likes’) ) {
sendGAevent({
hitType: ‘event’,
eventCategory: ‘social’,
eventAction: ‘Facebook’,
eventLabel: ‘like-odyssey’,
eventValue: window.location.href,
dimension17: ‘Unlike Odyssey on Facebook (Article Page)’
});
}
});
};
if(window.REBELMOUSE_STDLIB != undefined)
window.REBELMOUSE_STDLIB.createElementChangeListener(‘#fb-root’, sendFBEvents);
});
Source link