Posts

Showing posts from September, 2018

set in ascending order based on text

$('button').click(function() {     var options = $('select.whatever option');     var arr = options.map(function(_, o) {         return {             t: $(o).text(),             v: o.value         };     }).get();     arr.sort(function(o1, o2) {         return o1.t > o2.t ? 1 : o1.t < o2.t ? -1 : 0;     });     options.each(function(i, o) {         console.log(i);         o.value = arr[i].v;         $(o).text(arr[i].t);     }); });

More Than one Pointer location for MAP

HUBL CODE -  https://prnt.sc/p513h2 ======================== <div id="map-aux"></div> <script> var count = 0; var locations = []; function initMap() { {% for item in module.item %} //Resize Function google.maps.event.addDomListener(window, "resize", initMap); var location = [{{ item.latitude }}, {{ item.longitude }}, count, "{{ item.address.title }}", "{{ item.address.address }}", "{{ item.address.telephone_number }}" ]; locations.push(location); count++ var mapDiv = document.getElementById('map-aux'); var map = new google.maps.Map(mapDiv, { center: new google.maps.LatLng({{ module.map_position.position.latitude }}, {{ module.map_position.position.longitude }}), zoom: {{ module.map_position.map_zoom }}, // zoomControl: false, scrollwheel:  false, mapTypeControl: false, scaleControl: false, streetViewControl: false, controls: true }); v

FOR LIGHTBOX

{% set slides = [] %} {% for slide in module.slides %} {% if (slide.link_url is string_startingwith "http") or (slide.link_url is string_startingwith "/") %} {% set link = slide.link_url %} {% elif !slide.link_url %} {% set link = none %} {% else %} {% set link = "//" ~ slide.link_url %} {% endif %} {{ slides.append({ "caption":  slide.caption,         "show_caption": slide.show_caption,         "link_url": link,         "alt_text": slide.img.alt,         "img_src": slide.img.src,         "open_in_new_tab": slide.open_in_new_tab         }) | string | replace('true', '')     }} {% endfor %} <div class='custom_lightbox_slider image_{{ module.display_mode }}'>   {% gallery       "Gallery"       display_mode='{{ module.display_mode }}'       sizing='{{ module.sizing }}',       transition='{{ module.transition }}&#

custom lightbox using gallery module in custom module

{% set slides = [] %} {% for slide in module.slides %} {% if (slide.link_url is string_startingwith "http") or (slide.link_url is string_startingwith "/") %} {% set link = slide.link_url %} {% elif !slide.link_url %} {% set link = none %} {% else %} {% set link = "//" ~ slide.link_url %} {% endif %} {{ slides.append({ "caption":  slide.caption,         "show_caption": slide.show_caption,         "link_url": link,         "alt_text": slide.img.alt,         "img_src": slide.img.src,         "open_in_new_tab": slide.open_in_new_tab         }) | string | replace('true', '')     }} {% endfor %} <div class='custom_lightbox_slider image_{{ module.display_mode }}'>   {% gallery       "Gallery"       display_mode='{{ module.display_mode }}'       sizing='{{ module.sizing }}',       transition='{{ module.transition }}&#

Pagination of multiple recent post blog

<div class="blog-section">   <div class="blog-listing-wrapper cell-wrapper">     <div class="post-listing clearfix">       {% set blog_one_posts = blog_recent_posts('6126215542', 200) %} <!-- sets a variable for a the 5 most recent posts of my default COS blog -->       {% set blog_two_posts = blog_recent_posts('6126300566', 200) %}  <!-- sets a variable for a the 5 most recent posts of my blog id 47082700. You can find the blog id in the URL of the blog dashboard for a particular blog-->       {% set blog_three_posts = blog_recent_posts('6130453958', 200) %}       {% set blog_four_posts = blog_recent_posts('6131348719', 200) %}       {% set all_posts = (blog_one_posts + blog_two_posts + blog_three_posts + blog_four_posts) | sort(true, false, 'publish_date')  %} <!-- combines the two variables into a single variable and sorts them by publish date. Please note the sort filter r