Skip to content

Instantly share code, notes, and snippets.

@oliverdoetsch
oliverdoetsch / AND_OR_NOT
Last active Jan 12, 2021
Blogger: Globally conditional data tags for all page types
View AND_OR_NOT
#AND
<b:if cond='data:blog.pageType == "index"'>
<b:if cond='data:blog.searchQuery'>
<!--search_page AND index_page-->
</b:if>
</b:if>
#OR
@oliverdoetsch
oliverdoetsch / linkify.js
Last active Aug 29, 2015
wandelt In Blogger-Kommentare Text-Links in klickbare Links um
View linkify.js
<script type='text/javascript'>
//<![CDATA[
(function($){
var url1 = /(^|&lt;|\s)(www\..+?\..+?)(\s|&gt;|$)/g,
url2 = /(^|&lt;|\s)(((https?|ftp):\/\/|mailto:).+?)(\s|&gt;|$)/g,
linkifyThis = function () {
var childNodes = this.childNodes,
i = childNodes.length;
View full_image_vanilla_js_mn.js
<script type='text/javascript'>
//<![CDATA[
document.addEventListener("DOMContentLoaded",function(){var h=/\/s\B\d{2,4}/,g=document.getElementsByClassName("post-body")[0].offsetWidth,a=document.querySelectorAll(".post-body table");if("undefined"!=typeof a&&null!==a)for(var b=a.length;b--;){var d=a[b],c=document.createElement("div");c.setAttribute("class","separator");var e=document.createElement("div");e.style.textAlign="center";var f=a[b].querySelector("a").cloneNode(!0);c.appendChild(f);d.parentNode.replaceChild(c,d);a[b].querySelector(".tr-caption")&&
(d=a[b].querySelector(".tr-caption").innerText||a[b].querySelector(".tr-caption").textContent,e.innerHTML=d,c.appendChild(e))}a=document.querySelectorAll(".post-body img");for(b=a.length;b--;)c=a[b].height,e=a[b].width,d=Math.round(g/(e/c)),f="",f=e>=c?g:d,c=a[b].getAttribute("src").replace(h,"/s"+f),a[b].removeAttribute("width"),a[b].removeAttribute("height"),a[b].parentNode.removeAttribute("style"),a[b].style.marginLeft="0",a[b].style.padding="0",a[b].style
View script_jquery.js
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
var postWidth = $('.post-body').width();
var sAttribut = /\/s\B\d{2,4}/;
$('.post-body').find('img').each(function(n, image) {
var thisHeight = $(this).height();
var thisWidth = $(this).width();
var thisRatio = thisWidth / thisHeight;
var newWidth = postWidth;
View script_full_image_vanilla_js.js
<script type="text/javascript">
//<![CDATA[
document.addEventListener('DOMContentLoaded', function() {
var sAttribut = /\/s\B\d{2,4}/;
var postWidth = document.getElementsByClassName('post-body')[0].offsetWidth;
var table = document.querySelectorAll('.post-body table');
if (typeof(table) != 'undefined' && table !== null) {
var n = table.length;
while (n--) {
var oldNode = table[n];
@oliverdoetsch
oliverdoetsch / image_full.js
Last active Apr 7, 2021
Give a Image 100% post-width inside a blogger blog.
View image_full.js
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
var postWidth = $('.post-body').width();
var sAttribut = /\/s\B\d{2,4}/;
$('.post-body').find('table').each(function() {
$(this).find('a').unwrap().unwrap();
$(this).find('.tr-caption').unwrap();
$(this).replaceWith($('table').html()
View FB, Twitter & G+ Buttons
<b:if cond='data:top.showEmailButton'>
<div class='social-buttons'>
<!-- G+ button Start -->
<span class='g-plusone' data-align='left' data-annotation='bubble' data-size='medium' data-width='30' expr:data-href='data:post.canonicalUrl'/>
<!-- G+ button Start -->
<!-- Twitter button Start -->
<a class='twitter-share-button' data-lang='de' data-size='medium' data-width='20' expr:data-url='data:post.canonicalUrl' href='https://twitter.com/share'> Twittern</a>
<script>
@oliverdoetsch
oliverdoetsch / resizeImage.css
Last active Sep 24, 2018
automatically resize blogger images to fit full blog post area
View resizeImage.css
.post-body img {
width: $(content.width);
height: auto;
margin-left: -1em;
padding: 0;
border: none;
max-width: 100%;
}
.post-body .tr-caption-container {
@oliverdoetsch
oliverdoetsch / resizeImage.js
Last active Sep 3, 2018
automatically resize blogger images to fit full blog post area
View resizeImage.js
<script language='javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'/>
<script type='text/javascript'>
//<![CDATA[
$(document).ready(function() {
$.fn.resizeImage = function() {
$('.post-body').table_to_div();
var postWidth = $('.post-body').width();
var sAttribut = /\/s\B\d{2,4}/;
$('.post-body').find('img').each(function(n, image){
View gist:8164086
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<style>
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;