Skip to content

Commit

Permalink
initial commit including old lib
Browse files Browse the repository at this point in the history
  • Loading branch information
tech-adtechnology committed Dec 22, 2016
1 parent ab9f828 commit 7033ebd
Show file tree
Hide file tree
Showing 14 changed files with 1,169 additions and 21 deletions.
124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
module.exports = function(grunt) {

grunt.initConfig({
jshint: {
beforeuglify: ['CDN-Scripts/smartad_unmin_dev.js', 'CDN-Scripts/divscripte/*unmin.js', 'CDN-Scripts/pages/*_sp.js', 'CDN-Scripts/partners/*.js', 'build/includePartner.js'],
//afteruglify: ['CDN-Scripts/smartad.js'],
/*filter: function(filepath) {
return (filepath.match(/bkp|backup/i))? !0 : !1;
},*/
options: {
maxerr: 50000,
ignores: ['CDN-Scripts/partners/prebidLib.js','CDN-Scripts/partners/prebidLib_unmin.js'],
globals: {
'console': true
},
boss: !0,
curly: !0,
eqeqeq: true,
forin: !0,
asi: !0,
nonbsp: !1,
globalstrict: !1,
reporter: 'node_modules/jshint-stylish',
reporterOutput: 'JSDriver-Tests/lintlog.js',
smarttabs: !0,
expr: !0
}
},
uglify: {
build: {
files: [{
'CDN-Scripts/smartad.js': ['CDN-Scripts/smartad_unmin.js'],
'CDN-Scripts/divscripte/adplayer.js': ['CDN-Scripts/divscripte/adplayer_unmin.js'],
'CDN-Scripts/divscripte/adplayer.sas.js': ['CDN-Scripts/divscripte/adplayer.sas_unmin.js']
}]
},
prod: {
files: [{
expand: true,
src: ['**/*.js'],
cwd: 'build/pages/',
dest: 'CDN-Scripts/pages'
}]
}
}
});

grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');

grunt.registerTask('default', ['jshint', 'uglify']);

};
47 changes: 27 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,44 @@
## Welcome to GitHub Pages
## HTML5Lib - a collection of scripts to use within HTML5 AdCreation and AdServing

You can use the [editor on GitHub](https://github.com/Unitadtechnologystandards/HTML5Lib/edit/master/README.md) to maintain and preview the content for your website in Markdown files.
The main challenge by serving HTML5 Ads is [CORS (Cross-Origin Resource Sharing)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS).
The former used object tag to serve the flash plugin has been part of the main page, therefore actionScript could easily access all informations
form the mainpage and invoke functions if they have been there.

Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files.
HTML5 are HTML documents, the same like each other website on the world, included within an iFrame pointing to a foreign domain.
CORS concludes to never let a frame access another frame of a different origin.
That means that a script within an HTML5 AD is not allowed to resize it's own iFrame or manipulate any other element on the main page by his owm like flash could via actionScript

### Markdown
To make this work HTML5 itself offers a communicator called ["postMessage"](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage).
This allows us to send information to any frame even if do may not access it directly.

Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for
### without postMessage Use Cases

```markdown
Syntax highlighted code block
Some features do not need communication with the mainpage while working, these are

# Header 1
## Header 2
### Header 3
```
* clicktag
* localConnect
- Bulleted
- List
```

1. Numbered
2. List
### postMessage Use Cases

**Bold** and _Italic_ and `Code` text
These action will need to have a postMessage support:

[Link](url) and ![Image](src)
```
For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/).
* Expand/Collapse
* Hide/Show/Close
### Jekyll Themes
```

Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/Unitadtechnologystandards/HTML5Lib/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file.
### full library

The repository also offers the former library state April 2015.
However, the snippets are written to work either the full lib is already integrated or not

### Support or Contact

Having trouble with Pages? Check out our [documentation](https://help.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out.
This repository is meant to be reviewed and updated by each member of OVK.

If you have questions please submit an [issue](https://github.com/Unitadtechnologystandards/HTML5Lib/issues) or send a mail to ![info@bvdw.org](mailto:info@bvdw.org) subject **HTML5Lib**
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
theme: jekyll-theme-hacker
theme: jekyll-theme-slate
30 changes: 30 additions & 0 deletions src/creative/Clicktag.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<script>
/* init method to get URI params, where 'clicktag', 'target' and 'frameId' will be passed */
var getUriParams = function() {
var query_string = {}
var query = window.location.search.substring(1);
var parmsArray = query.split('&');
if(parmsArray.length <= 0) return query_string;
for(var i = 0; i < parmsArray.length; i++) {
var pair = parmsArray[i].split('=');
var val = decodeURIComponent(pair[1]);
if (val != '' && pair[0] != '') query_string[pair[0]] = val;
}
return query_string;
}();

/* one way of using the clicktag is to set the URI from SRC as href and also the target of an a-tag */
document.getElementById('clicktag').setAttribute('href', getUriParams.clicktag).setAttribute('target', getUriParams.target);

/* another way of using the clicktag by using the URI as well as the link-target as window.open param */
function openLandingPage() {
window.open(getUriParams.clicktag, getUriParams.target);
}

/* to use more than one click tag you have to go on like this: */
document.getElementById('clicktag2').setAttribute('href', getUriParams.clicktag2).setAttribute('target', getUriParams.target2);
/* or */
function openLandingPage() {
window.open(getUriParams.clicktag2, getUriParams.target2);
}
</script>
32 changes: 32 additions & 0 deletions src/creative/close.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* to be placed in the ad at the end*/
/* init method to get URI params, where 'frameId' will be passed, should already be included from clicktag.js */
var getUriParams = function() {
var query_string = {}
var query = window.location.search.substring(1);
var parmsArray = query.split('&');
if(parmsArray.length <= 0) return query_string;
for(var i = 0; i < parmsArray.length; i++) {
var pair = parmsArray[i].split('=');
var val = decodeURIComponent(pair[1]);
if (val != '' && pair[0] != '') query_string[pair[0]] = val;
}
return query_string;
}();

/* please change function name 'closeAd' to whatever your close-method get called by the creative or let the ad call this function 'as is' when closing the ad */
/* the ad get's removed from the dom */
closeAd = function() {
window.top.postMessage('closeAd:;:' + getUriParams.frameId ,'*');
}

/* please change function name 'hideAd' to whatever your close-method get called by the creative or let the ad call this function 'as is' when closing the ad */
/* the ad is hidden by display: none */
hideAd = function() {
window.top.postMessage('hideAd:;:' + getUriParams.frameId ,'*');
}

/* the ad is hidden by display: none */
showAd = function() {
window.top.postMessage('showAd:;:' + getUriParams.frameId ,'*');
}
</script>
23 changes: 23 additions & 0 deletions src/creative/expand.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* to be placed in the ad at the end*/
/* init method to get URI params, where 'frameId' will be passed, should already be included from clicktag.js */
var getUriParams = function() {
var query_string = {}
var query = window.location.search.substring(1);
var parmsArray = query.split('&');
if(parmsArray.length <= 0) return query_string;
for(var i = 0; i < parmsArray.length; i++) {
var pair = parmsArray[i].split('=');
var val = decodeURIComponent(pair[1]);
if (val != '' && pair[0] != '') query_string[pair[0]] = val;
}
return query_string;
}();

/* please change 'expandAd' and 'contractAd' to whatever your methods get called by the creative or let the ad call this functions 'as they are' */
expandAd = function() {
window.top.postMessage('expandAd:;:' + getUriParams.frameId + ':;:' + expandedWidth + ':;:' + expandedHeight,'*');
}
collapseAd = function() {
window.top.postMessage('contractAd:;:' + getUriParams.frameId + ':;:' + expandedWidth + ':;:' + expandedHeight + ':;:' + expandedDirection + ':;:' + clipValue,'*');
}
</script>
Loading

0 comments on commit 7033ebd

Please sign in to comment.