Skip to content

kaovilai/AdJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AdJS - Skip fiddling with HTML code everytime you have a new sponsor 😜

CI

AdJS is a suite of tools that make embedding a list of linked images easy. Makes it easy to embed thirdparty ads without editing Blogger themes HTML so you don't lose theme preview.

See test site at adjs.tig.pw Currently being used on my blog, and some other fun sites

Issues and PRs welcome.

Documentation are in JSDoc format inside ad.js

Getting Started

  1. Place one of the snippets where you want ads to show up
<!-- Sidebar ad snippet -->
<div id="sidebar-ad"></div>
<script src="https://adjs.tig.pw/ad.js" onload="populateKeys(['topbar_ad','sidebar_top_ad','sidebar_bottom_ad','midpage_ad','footer_ad']);" defer></script>
  1. Put in your json file as the source parameter formatted like this this
{
    "header":[
        {
            "network":"",
            "company":"",
            "campaign":"",
            "href":"",
            "img":"",
            "expire":false
        }
    ],
    "sidebar":[
                    "network":"",
                    "company":"",
                    "campaign":"",
                    "href":"",
                    "img":"",
                    "expire":true
                }
    ],
    "midpage":[

    ],
    "footer":[

    ]
}

Blogger Setup

Go to your site's layouts page and embed the script through adding HTML/Script gadget to sidebars or other areas.

You can then choose what elementId aka id="*" get to have an ad, and it can be anything you can see with your browser's DevTools. In my blog, I was able to simply replace to footer area. With some further enhancements, AdJS should be able to add onto the page instead of replacing .innerhtml. Now editing blogger themes will be in your past. Switching themes is easy without risk losing your setup.