Skip to content

Instantly share code, notes, and snippets.

View lerniri's full-sized avatar

Iriska lerniri

  • Tel Aviv, Israel
View GitHub Profile
@lerniri
lerniri / offset-map-center.js
Created April 27, 2020 10:46
Offsets map center after search is run
function storemapper_after_search_result() {
// This function is called after search results
// are displayed in the page
map_recenter(Storemapper.map, Storemapper.map.getCenter(), 0, -150);
}
function map_recenter(map, latlng,offsetx,offsety) {
var point1 = map.getProjection().fromLatLngToPoint(
(latlng instanceof google.maps.LatLng) ? latlng : map.getCenter()
);
@lerniri
lerniri / pre_select_cat.js
Created March 22, 2020 13:47
pre-select category
function storemapper_callback() {
// Called immediately after Storemapper finishes loading
document.querySelector("[data-value='category']").click();
}
@lerniri
lerniri / 1-location-layout.css
Created March 3, 2020 13:29
Styling 1 location Storemapper
#storemapper {
position:relative!important;
}
#storemapper #storemapper-left {
position:absolute!important;
z-index:999;
right:60px;
top:60px;
overflow:hidden!important;
function storemapper_callback() {
sortListByTier();
}
function sortListByTier() {
let listArr = Array.from(document.querySelectorAll("#storemapper-list li"));
listArr.sort(function(a, b) {
if (a.className < b.className) {
return -1;
@lerniri
lerniri / SM_zoom_in_on_click.js
Created February 7, 2020 10:08
Storemapper: Zoom in upon view on map button click.
function zoom_in_map() {
Storemapper.map.setZoom(16);
}
function storemapper_callback() {
var view_btn = document.querySelectorAll('.storemapper_view a');
view_btn.forEach(function(el) {
el.addEventListener('click', zoom_in_map);
});
@lerniri
lerniri / group-stores-by-states.js
Created July 26, 2019 14:49
group-stores-by-states
function storemapper_callback() {
// Called immediately after Storemapper finishes loading
sort_categories();
sort_list_per_cat();
/* Add Event Listener on List */
var catCheckboxes = document.querySelectorAll('#storemapper-filter-drop-down a');
for (var i = 0, len = catCheckboxes.length; i < len; i++) {
function storemapper_callback() {
// Called immediately after Storemapper finishes loading
sort_categories();
}
function storemapper_after_search_result() {
// This function is called after search results
// are displayed in the page
sort_categories();
}
#storemapper-left { float: right;}
#storemapper-list { text-align: right; }
#storemapper svg {
right: 0;
left: auto;
}
#storemapper:not(.hide_icons) .storemapper-address,
/* Below code switches layout to list on the right , map on the left.
Copy this contence and past to Advanced settings under your Storemapper account
For more info on using custom CSS check this article:
https://www.storemapper.co/support/customizing-storemapper-with-css/
*/
#storemapper-left { float: right; padding-left: 10px; }
@lerniri
lerniri / storemapper_scheme-generator.html
Created December 21, 2017 16:20
Storemapper color scheme css generator
<h2>Choose color theme</h2>
<div class="form" style="width:500px;">
<label for="primary-color">Choose primary color</label>
<input type="color" id="primary-color">
<br>
<br>
<label for="secondary-color">Chose secondary color</label>
<input type="color" id="secondary-color">
<br>