Commit c7898ff9 authored by Simonas's avatar Simonas

in progress

parent d38639ee
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -71,6 +71,8 @@
<?php
global $post;
// debug(get_post_type());
if ( get_post_type() == 'page'):
if ( get_post_meta( $post->ID, 'section', true) == 'employers'):
......@@ -120,11 +122,13 @@
wp_reset_query();
endif;
/*
else:
?>
<div id="fb-root"></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.3&appId=463001014486058&autoLogAppEvents=1"></script>
<?php
*/
endif;
?>
......
......@@ -8,7 +8,7 @@
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\nlet isPageActive = true;\n\nwindow.onfocus = function () {\n isPageActive = true;\n};\n\nwindow.onblur = function () {\n isPageActive = false;\n};\n\nfunction fallbackCopyTextToClipboard(text) {\n var textArea = document.createElement('textarea');\n textArea.className = 'u-hidden';\n textArea.value = text;\n document.querySelector('.c-share').appendChild(textArea);\n textArea.focus();\n textArea.select();\n\n try {\n var successful = document.execCommand('copy');\n var msg = successful ? 'successful' : 'unsuccessful';\n console.log('Fallback: Copying text command was ' + msg);\n } catch (err) {\n console.error('Fallback: Oops, unable to copy', err);\n }\n\n document.body.removeChild(textArea);\n}\n\nfunction showCopyTooltip() {\n const tooltip = document.querySelector('#copy-tooltip');\n\n if (tooltip) {\n tooltip.style.opacity = 1;\n setTimeout(() => {\n tooltip.style.opacity = 0;\n }, 3000);\n }\n}\n\nfunction copyTextToClipboard(text) {\n if (!navigator.clipboard) {\n fallbackCopyTextToClipboard(text);\n showCopyTooltip();\n return;\n }\n\n navigator.clipboard.writeText(text).then(function () {\n showCopyTooltip();\n }, function (err) {\n console.error('Async: Could not copy text: ', err);\n });\n}\n\nconst inititateJobShare = () => {\n if (document.querySelector('.js-copy-to-clipboard')) {\n document.querySelector('.js-copy-to-clipboard').addEventListener('click', e => {\n e.preventDefault();\n copyTextToClipboard(window.location.origin + window.location.pathname + '?utm_source=copy_share_button_job_page ');\n });\n }\n\n const messenger = document.querySelector('.js-share-messenger');\n\n if (messenger) {\n messenger.addEventListener('click', e => {\n e.preventDefault();\n const target = e.currentTarget;\n window.location.href = 'fb-messenger://share/?link=' + encodeURIComponent(window.location.origin + window.location.pathname + '?utm_source=messenger_share_button_job_page&app_id=' + target.dataset.id);\n setTimeout(() => {\n if (document.hidden || !isPageActive) {\n return;\n }\n\n window.location.href = target.href;\n }, 100);\n });\n }\n\n const whatsapp = document.querySelector('.js-share-whatsapp');\n\n if (whatsapp) {\n whatsapp.addEventListener('click', e => {\n e.preventDefault();\n const target = e.currentTarget;\n window.location.href = 'whatsapp://send?text=' + target.dataset.text;\n setTimeout(() => {\n if (document.hidden || !isPageActive) {\n return;\n }\n\n window.open(target.href, '_blank');\n }, 100);\n });\n }\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (inititateJobShare);\n\n//# sourceURL=webpack:///./wp-content/themes/biuro/js/components/job-share/job-share.js?");
eval("__webpack_require__.r(__webpack_exports__);\nasync function inititateFacebook(ID, href) {\n fetch('https://connect.facebook.net/en_US/sdk.js').then(res => {\n console.error('res');\n console.dir(typeof window.FB); // return response.json();\n }).then(json => {\n console.error('got it');\n console.dir(typeof window.FB);\n }); // const { default: inititateJobShare } = await import('./job-share/job-share');\n // return inititateJobShare;\n}\n\nlet isPageActive = true;\n\nwindow.onfocus = function () {\n isPageActive = true;\n};\n\nwindow.onblur = function () {\n isPageActive = false;\n};\n\nfunction fallbackCopyTextToClipboard(text) {\n var textArea = document.createElement('textarea');\n textArea.className = 'u-hidden';\n textArea.value = text;\n document.querySelector('.c-share').appendChild(textArea);\n textArea.focus();\n textArea.select();\n\n try {\n var successful = document.execCommand('copy');\n var msg = successful ? 'successful' : 'unsuccessful';\n console.log('Fallback: Copying text command was ' + msg);\n } catch (err) {\n console.error('Fallback: Oops, unable to copy', err);\n }\n\n document.body.removeChild(textArea);\n}\n\nfunction showCopyTooltip() {\n const tooltip = document.querySelector('#copy-tooltip');\n\n if (tooltip) {\n tooltip.style.opacity = 1;\n setTimeout(() => {\n tooltip.style.opacity = 0;\n }, 3000);\n }\n}\n\nfunction copyTextToClipboard(text) {\n if (!navigator.clipboard) {\n fallbackCopyTextToClipboard(text);\n showCopyTooltip();\n return;\n }\n\n navigator.clipboard.writeText(text).then(function () {\n showCopyTooltip();\n }, function (err) {\n console.error('Async: Could not copy text: ', err);\n });\n}\n\nconst inititateJobShare = () => {\n if (document.querySelector('.js-copy-to-clipboard')) {\n document.querySelector('.js-copy-to-clipboard').addEventListener('click', e => {\n e.preventDefault();\n copyTextToClipboard(window.location.origin + window.location.pathname + '?utm_source=copy_share_button_job_page ');\n });\n }\n\n const messenger = document.querySelector('.js-share-messenger');\n\n if (messenger) {\n messenger.addEventListener('click', e => {\n e.preventDefault();\n const target = e.currentTarget;\n window.location.href = 'fb-messenger://share/?link=' + encodeURIComponent(window.location.origin + window.location.pathname + '?utm_source=messenger_share_button_job_page&app_id=' + target.dataset.id);\n setTimeout(() => {\n if (document.hidden || !isPageActive) {\n return;\n }\n\n window.location.href = target.href;\n }, 100);\n });\n }\n\n const whatsapp = document.querySelector('.js-share-whatsapp');\n\n if (whatsapp) {\n whatsapp.addEventListener('click', e => {\n e.preventDefault();\n const target = e.currentTarget;\n window.location.href = 'whatsapp://send?text=' + target.dataset.text;\n setTimeout(() => {\n if (document.hidden || !isPageActive) {\n return;\n }\n\n window.open(target.href, '_blank');\n }, 100);\n });\n }\n\n const facebook = document.querySelector('.js-biuro-facebook');\n\n if (facebook) {\n inititateFacebook(facebook.dataset.id, facebook.dataset.href);\n }\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (inititateJobShare);\n\n//# sourceURL=webpack:///./wp-content/themes/biuro/js/components/job-share/job-share.js?");
/***/ })
......
async function inititateFacebook (ID, href) {
fetch('https://connect.facebook.net/en_US/sdk.js')
.then((res) => {
console.error('res');
console.dir(typeof window.FB);
// return response.json();
})
.then((json) => {
console.error('got it');
console.dir(typeof window.FB);
});
// const { default: inititateJobShare } = await import('./job-share/job-share');
// return inititateJobShare;
}
let isPageActive = true;
window.onfocus = function () {
......@@ -99,6 +116,12 @@ const inititateJobShare = () => {
}, 100);
});
}
const facebook = document.querySelector('.js-biuro-facebook');
if (facebook) {
inititateFacebook(facebook.dataset.id, facebook.dataset.href);
}
};
export default inititateJobShare;
......@@ -283,7 +283,7 @@ if (document.getElementById('js-map--divisions') || document.getElementById('js-
});
}
if (document.querySelector('.js-copy-to-clipboard') || document.querySelector('.js-share-messenger') || document.querySelector('.js-share-whatsapp')) {
if (document.querySelector('.js-copy-to-clipboard') || document.querySelector('.js-share-messenger') || document.querySelector('.js-share-whatsapp') || document.querySelector('.js-biuro-facebook')) {
getJobShare().then(inititateJobShare => {
inititateJobShare();
});
......
This diff is collapsed.
......@@ -55,22 +55,22 @@
<div class="c-share">
<p class="c-share--heading"><?php _e('Suggest a friend', 'biuro'); ?></p>
<div class="c-share--options">
<a rel="noopener" href="https://www.facebook.com/dialog/share?app_id=<?php echo $appID; ?>&display=popup&amp;href=<?php echo urlencode($requestURL . '?utm_source=facebook_share_button_job_page'); ?>&redirect_uri=<?php echo $requestURL; ?>" class="gtm-share-click js-share-facebook c-share--option c-share--option-facebook" data-label="Facebook">
<a rel="noopener" href="https://www.facebook.com/dialog/share?app_id=<?php echo $appID; ?>&display=popup&amp;href=<?php echo urlencode($requestURL . '?utm_source=facebook_share_button_job_page'); ?>&redirect_uri=<?php echo $requestURL; ?>" class="gtm-share-click js-share-facebook c-share--option c-share--option-facebook" data-label="Facebook" aria-label="Facebook">
<svg width="9px" height="18px" class="c-ico--share-facebook">
<use xlink:href="#ico--job-facebook"></use>
</svg>
</a>
<a rel="noopener" href="https://www.facebook.com/dialog/send?app_id=<?php echo $appID; ?>&amp;link=<?php echo urlencode($requestURL . '?utm_source=messenger_share_button_job_page'); ?>&redirect_uri=<?php echo $requestURL; ?>" class="gtm-share-click js-share-messenger c-share--option c-share--option-messenger" data-label="Messenger" data-id="<?php echo $appID; ?>">
<a rel="noopener" href="https://www.facebook.com/dialog/send?app_id=<?php echo $appID; ?>&amp;link=<?php echo urlencode($requestURL . '?utm_source=messenger_share_button_job_page'); ?>&redirect_uri=<?php echo $requestURL; ?>" class="gtm-share-click js-share-messenger c-share--option c-share--option-messenger" data-label="Messenger" aria-label="Messenger" data-id="<?php echo $appID; ?>">
<svg width="15px" height="15px" class="c-ico--share-messenger">
<use xlink:href="#ico--job-messenger"></use>
</svg>
</a>
<a href="<?php echo $mailto; ?>" class="gtm-share-click c-share--option c-share--option-email" data-label="Email">
<a href="<?php echo $mailto; ?>" class="gtm-share-click c-share--option c-share--option-email" data-label="Email" aria-label="Email">
<svg width="17px" height="13px" class="c-ico--share-email">
<use xlink:href="#ico--job-email"></use>
</svg>
</a>
<a href="#" class="js-copy-to-clipboard gtm-share-click c-share--option c-share--option-copy" data-label="Copy">
<a href="#" class="js-copy-to-clipboard gtm-share-click c-share--option c-share--option-copy" data-label="Copy" aria-label="Copy">
<svg width="15px" height="18px" class="c-ico--share-copy">
<use xlink:href="#ico--job-copy"></use>
</svg>
......@@ -78,7 +78,7 @@
<?php _e('The link copied to the clipboard', 'biuro'); ?>
</div>
</a>
<a target="_blank" rel="noopener" href="https://wa.me/?text=<?php echo $waText; ?>" data-text="<?php echo $waText; ?>" class="js-share-whatsapp gtm-share-click c-share--option c-share--option-phone" data-label="WhatsApp">
<a target="_blank" rel="noopener" href="https://wa.me/?text=<?php echo $waText; ?>" data-text="<?php echo $waText; ?>" class="js-share-whatsapp gtm-share-click c-share--option c-share--option-phone" data-label="WhatsApp" aria-label="WhatsApp">
<svg width="17px" height="18px" class="c-ico--share-whatsapp">
<use xlink:href="#ico--job-whatsapp"></use>
</svg>
......@@ -113,10 +113,14 @@
$facebook_site = isset( $social['facebook_site']) ? $social['facebook_site'] : '';
if ($facebook_site != ''):
?>
<div class="c-job-facebook">
<div class="js-biuro-facebook c-job-facebook" data-id="<?php echo $appID; ?>" data-href="<?php echo $facebook_site; ?>">
<?php
/*
<div class="fb-page" data-href="<?php echo $facebook_site; ?>" data-tabs="" data-width="" data-height="" data-small-header="false" data-adapt-container-width="true" data-hide-cover="false" data-show-facepile="true"><blockquote cite="<?php echo $facebook_site; ?>" class="fb-xfbml-parse-ignore"><a href="<?php echo $facebook_site; ?>">Biuro</a></blockquote></div>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v3.3&appId=<?php echo $appID; ?>&autoLogAppEvents=1"></script>
*/
?>
</div>
<?php
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment