diff --git a/3p/integration.js b/3p/integration.js index 3ed5db951db7..34905f25af0d 100644 --- a/3p/integration.js +++ b/3p/integration.js @@ -215,6 +215,7 @@ import {relap} from '../ads/relap'; import {revcontent} from '../ads/revcontent'; import {revjet} from '../ads/revjet'; import {rfp} from '../ads/rfp'; +import {rnetplus} from '../ads/rnetplus'; import {rubicon} from '../ads/rubicon'; import {runative} from '../ads/runative'; import {sas} from '../ads/sas'; @@ -459,6 +460,7 @@ register('relap', relap); register('revcontent', revcontent); register('revjet', revjet); register('rfp', rfp); +register('rnetplus', rnetplus); register('rubicon', rubicon); register('runative', runative); register('sas', sas); diff --git a/ads/_config.js b/ads/_config.js index f24bde1ab255..d26739fc6bf8 100644 --- a/ads/_config.js +++ b/ads/_config.js @@ -838,6 +838,8 @@ export const adConfig = { renderStartImplemented: true, }, + 'rnetplus': {}, + 'rubicon': {}, 'runative': { diff --git a/ads/rnetplus.js b/ads/rnetplus.js new file mode 100644 index 000000000000..bf54c0dedef8 --- /dev/null +++ b/ads/rnetplus.js @@ -0,0 +1,57 @@ +/** + * Copyright 2019 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, validateData, validateSrcPrefix} from '../3p/3p'; + +const jsnPrefix = 'https://api.rnet.plus/'; + +/** + * @param {!Window} global + * @param {!Object} data + */ +export function rnetplus(global, data) { + validateData(data, ['src']); + const {src} = data; + validateSrcPrefix(jsnPrefix, src); + createContainer(global, 'rnetplus_' + getBlockId(src)); + loadScript(global, src); +} + +/** + * @param {!Window} global + * @param {string} renderTo + */ +function createContainer(global, renderTo) { + const d = global.document.createElement('div'); + d.id = renderTo; + global.document.getElementById('c').appendChild(d); +} + +/** + * @param {string} src + * @return {string} + */ +function getBlockId(src) { + const parts = src.split('?'); + const vars = parts[1].split('&'); + for (let j = 0; j < vars.length; ++j) { + const pair = vars[j].split('='); + if (pair[0] == 'blockId') { + return pair[1]; + } + } + return '660'; +} diff --git a/ads/rnetplus.md b/ads/rnetplus.md new file mode 100644 index 000000000000..afd52085af30 --- /dev/null +++ b/ads/rnetplus.md @@ -0,0 +1,36 @@ + + +# RnetPlus + +Provides support for [rnetplus](https://admin.rnet.plus/help/) Rambler&Co RNetPlus. + +## Example + +```html + + +``` + +## Configuration + +For details on the configuration semantics, please contact [Rambler](https://admin.rnet.plus/). + +### Required parameters + +- `src` diff --git a/examples/ads.amp.html b/examples/ads.amp.html index ed9a84ec4003..7a268da0350a 100644 --- a/examples/ads.amp.html +++ b/examples/ads.amp.html @@ -199,6 +199,7 @@ + @@ -1580,6 +1581,13 @@

Rambler&Co

json='{"params":{"p1":"bvpkq","p2":"y","pct":"a"}}'> +

Rambler&Co RNetPlus

+ + +

RbInfox