-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag '1454455326712-canary' into release
- Loading branch information
Showing
154 changed files
with
2,357 additions
and
601 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Copyright 2015 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import {loadScript, checkData} from '../src/3p'; | ||
|
||
/** | ||
* @param {!Window} global | ||
* @param {!Object} data | ||
*/ | ||
export function plista(global, data) { | ||
checkData(data, [ | ||
'publickey', 'widgetname', 'urlprefix', | ||
'item', 'geo', 'categories', 'countrycode' | ||
]); | ||
const div = global.document.createElement('div'); | ||
div.setAttribute('data-display', 'plista_widget_' + data.widgetname); | ||
// container with id "c" is provided by amphtml | ||
global.document.getElementById('c').appendChild(div); | ||
window.PLISTA = { | ||
publickey: data.publickey, | ||
widgets: [{ | ||
name: data.widgetname, | ||
pre: data.urlprefix | ||
}], | ||
item: data.item, | ||
geo: data.geo, | ||
categories: data.categories, | ||
noCache: true, | ||
useDocumentReady: false, | ||
dataMode: 'data-display' | ||
}; | ||
|
||
// load the plista modules asynchronously | ||
loadScript(global, 'https://static' + (data.countrycode ? '-' + encodeURIComponent(data.countrycode) : '') + '.plista.com/async.js'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<!--- | ||
Copyright 2015 The AMP HTML Authors. All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS-IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
# plista | ||
|
||
## Example | ||
|
||
### Basic | ||
|
||
```html | ||
<amp-ad width=300 height=300 | ||
type="plista" | ||
data-countrycode="de" | ||
data-publickey="e6a75b42216ffc96b7ea7ad0c94d64946aedaac4" | ||
data-widgetname="iAMP" | ||
data-categories="politics" | ||
> | ||
``` | ||
|
||
### With article information | ||
|
||
```html | ||
<amp-ad width=300 height=300 | ||
type="plista" | ||
data-countrycode="de" | ||
data-publickey="e6a75b42216ffc96b7ea7ad0c94d64946aedaac4" | ||
data-widgetname="iAMP" | ||
data-geo="de" | ||
data-urlprefix="" | ||
data-categories="politics" | ||
json='{"item":{"objectid":"1067327","url":"http://www.plista.com/article/a-1067337.html","updated_at":1449938206}}' | ||
> | ||
``` | ||
|
||
## Configuration | ||
|
||
For semantics of configuration, please see [ad network documentation](https://goo.gl/nm9f41). | ||
|
||
Supported parameters: | ||
|
||
- data-countrycode | ||
- data-publickey | ||
- data-widgetname | ||
- data-geo | ||
- data-urlprefix | ||
- data-categories | ||
|
||
Supported via `json` attribute: | ||
|
||
- item | ||
|
||
## Layout | ||
|
||
Width and height are optional. You can use different layout types with plista. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/** | ||
* Copyright 2015 The AMP HTML Authors. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS-IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import {loadScript, validateDataExists, validateExactlyOne} from '../src/3p'; | ||
|
||
/** | ||
* @param {!Window} global | ||
* @param {!Object} data | ||
*/ | ||
export function taboola(global, data) { | ||
// do not copy the following attributes from the 'data' object | ||
// to _tablloa global object | ||
const blackList = ['height', 'initialWindowHeight', 'initialWindowWidth', | ||
'type', 'width', 'placement', 'mode']; | ||
|
||
// ensure we have vlid publisher, placement and mode | ||
// and exactly one page-type | ||
validateDataExists(data, ['publisher', 'placement', 'mode']); | ||
validateExactlyOne(data, ['article', 'video', 'photo', 'search', 'category', | ||
'homepage', 'others']); | ||
|
||
// setup default values for referrer and url | ||
const params = { | ||
referrer: data.referrer || global.context.referrer, | ||
url: data.url || global.context.canonicalUrl | ||
}; | ||
|
||
// copy none blacklisted attribute to the 'params' map | ||
Object.keys(data).forEach(k => { | ||
if (blackList.indexOf(k) === -1) { | ||
params[k] = data[k]; | ||
} | ||
}); | ||
|
||
// push the two object into the '_taboola' global | ||
(global._taboola = global._taboola || []).push([{ | ||
viewId: global.context.pageViewId, | ||
publisher: data.publisher, | ||
placement: data.placement, | ||
mode: data.mode, | ||
framework: 'amp', | ||
container: 'c' | ||
}, | ||
params]); | ||
|
||
// install observation on entering/leaving the view | ||
global.context.observeIntersection(function(changes) { | ||
changes.forEach(function(c) { | ||
if (c.intersectionRect.height) { | ||
global._taboola.push({ | ||
visible: true, | ||
rects: c, | ||
placement: data.placement | ||
}); | ||
} | ||
}); | ||
}); | ||
|
||
// load the taboola loader asynchronously | ||
loadScript(global, `https://cdn.taboola.com/libtrc/${encodeURIComponent(data.publisher)}/loader.js`); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!--- | ||
Copyright 2015 The AMP HTML Authors. All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS-IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
# Taboola | ||
|
||
## Example | ||
|
||
### Basic | ||
|
||
```html | ||
<amp-embed width=100 height=283 | ||
type=taboola | ||
layout=responsive | ||
heights="(min-width:1907px) 39%, (min-width:1200px) 46%, (min-width:780px) 64%, (min-width:480px) 98%, (min-width:460px) 167%, 196%" | ||
data-publisher="amp-demo" | ||
data-mode="thumbnails-a" | ||
data-placement="Ads Example" | ||
data-article="auto"> | ||
</amp-embed> | ||
``` | ||
|
||
## Configuration | ||
|
||
For semantics of configuration, please see ad network documentation. | ||
|
||
Supported parameters: | ||
|
||
- data-publisher | ||
- data-placement | ||
- data-mode | ||
- data-article | ||
- data-video | ||
- data-photo | ||
- data-home | ||
- data-category | ||
- data-others | ||
- data-url | ||
- data-referrer |
Oops, something went wrong.