Skip to content

Instantly share code, notes, and snippets.

View Seorusus's full-sized avatar
🏠
Working from home

Oleg Kreminsky Seorusus

🏠
Working from home
View GitHub Profile
@Seorusus
Seorusus / animated-notifications.markdown
Created June 20, 2018 10:47
Animated notifications
@Seorusus
Seorusus / block--system-branding-block.html.twig
Last active February 24, 2019 18:37
Drupal schooler theme
<div class="container">
<div class="row">
<div class="col align-self-center">
{% block content %}
{% if site_logo %}
<p class="site-logo"> <a href="{{ path('<front>') }}" title="{{ 'Home'|t }}" rel="home">
<img src="{{ site_logo }}" alt="{{ 'Home'|t }}" />
</a> </p>
{% endif %}
</div>
$view = new view();
$view->name = 'guidelines_resources';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'node';
$view->human_name = 'Guidelines and Resources';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
@Seorusus
Seorusus / placeholder.php
Created March 13, 2019 10:57
Add placeholder
/**
* Add a placeholder in the search bar on the Search result pages.
*/
function dc_form_alter( &$form, &$form_state, $form_id ) {
if ($form['#id'] === 'views-exposed-form-search-results-page') {
// Adding placeholders to fields
$form['text']['#attributes']['placeholder'] = t( 'Whatcha lookin for?' );
}
}
@Seorusus
Seorusus / drupal.js
Created March 14, 2019 16:04
Add and remove classes to 'Clear filters' element
(function ($, Drupal) {
Drupal.behaviors.hideLink = {
attach: function () {
$('.selected-facets li').each(function() {
$(".reset-all-facets").removeClass('_display-none');
});
}
};
})(jQuery, Drupal);
<div class="swiper-slider-description">
<div class="_first">
<span class="_left">the</span><span class="_right">future</span>
</div>
<div class="_second">
Brand new & improved!
</div>
<div class="_third">
<p>the Future boasts clean and crispy design, bulletproof layout</p><p> consistence and intuitive navigation.</p>
</div>
@Seorusus
Seorusus / code.js
Created March 19, 2019 16:17
Add a popup closing on click anywhere. Можно заносить кол-во кликов в переменную и проверять кратность/некратность 2ум (numOfClicks % 2 !== 0):
jQuery(document).mouseup(function (e) {
jQuery(".view-facets .pane-content").each(function (i) {
var elem = jQuery(this);
if (e.target !== elem[0] && !elem.has(e.target).length) {
elem.hide();
$(".show-facet .pane-title").addClass("change");
let numOfClicks = 0;
const $elem = $(".show-facet .pane-title");
$elem.on('click', () => {
++numOfClicks;
// https://api.drupal.org/api/drupal/core!modules!block!templates!block.html.twig/8.2.x
{#
/**
* @file
* Default theme implementation to display a block.
*
* Available variables:
* - plugin_id: The ID of the block implementation.
* - label: The configured label of the block if visible.
* - configuration: A list of the block's configuration values.
@Seorusus
Seorusus / 1.css
Last active April 6, 2019 08:38
#21
.swiper-slider-description {
backface-visibility: hidden;
font-family: fira sans,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,sans-serif;
margin: 25vh 25vw;
position: absolute;
z-index: 2;
text-align: center;
width: 50vw;
height: 50vh;
}
(function ($, Drupal) {
$(document).ready(function () {
$(".bhide").click(function () {
$(".hideObj").slideDown();
$(this).hide(); //.attr()
return false;
});
$(".bhide2").click(function () {
$(".container.hideObj2").slideDown();
$(this).hide(); // .attr()