viceview-rails 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/lib/viceview/rails.rb +7 -0
- data/lib/viceview/rails/version.rb +5 -0
- data/vendor/assets/javascripts/viceview.js +94 -0
- metadata +92 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fc73268207068bd667d2092107d1ecc2a28e32e5
|
4
|
+
data.tar.gz: 1fccb57a1acba197bb87eb87fd04f5d4b6d4d507
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 364fb99d1e2a2cea71aae13ef762d1ced06627e7f5bef232bca7638d0e5649524c959196f834cd9291489630a4ae3caa793e2bd72c5beff76a350961a6b3cd94
|
7
|
+
data.tar.gz: c42853ffe3de9e89eb9ea2b4046ab47cf0c9927102be8652df7736a9e23d6cf65e8e59e3c7746fd7c3776e567570e7c8cfdcc436be44e17ded42e54cf57d2cb7
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2016 Ryan Folstad
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Viceview::Rails
|
2
|
+
|
3
|
+
|
4
|
+
I created this module for displaying Adsense ads over https on my single page web app: [https://www.datememe.com](https://www.datememe.com).
|
5
|
+
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'viceview-rails'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install viceview-rails
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```javascript
|
24
|
+
ViceView.showAdsense({adslot: {slot: "myslot", sizes: "[300,100]", id:"your adsenseid"}, element: "element", adwidth: 300, adheight: 100});
|
25
|
+
```
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
1. Fork it ( https://github.com/radiofrequency/viceview-rails/fork )
|
30
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
33
|
+
5. Create a new Pull Request
|
@@ -0,0 +1,94 @@
|
|
1
|
+
// ViceView.js 1.0.0
|
2
|
+
// (c) 2010-2016 Ryan Folstad, datememe.com
|
3
|
+
// ViceView may be freely distributed under the MIT license.
|
4
|
+
// For all details and documentation:
|
5
|
+
// http://github.com/radiofrequency/viceview
|
6
|
+
|
7
|
+
(function() {
|
8
|
+
'use strict';
|
9
|
+
var ViceView = {};
|
10
|
+
ViceView.showAdsense = function(options) {
|
11
|
+
//options.element name of element to place ad in.
|
12
|
+
//options.adslot adslot information
|
13
|
+
//options.adwidth width of the ad
|
14
|
+
//options.adheight height of the ad
|
15
|
+
|
16
|
+
if (options.element === undefined || options.element === null) {
|
17
|
+
console.error("no element specified");
|
18
|
+
return;
|
19
|
+
}
|
20
|
+
if (options.adslot === undefined || options.adslot === null) {
|
21
|
+
console.error("no adslot specified");
|
22
|
+
return;
|
23
|
+
} else {
|
24
|
+
if (options.adslot.slot === undefined || options.adslot.slot === null) {
|
25
|
+
console.error("no adslot.slot specified");
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
if (options.adslot.sizes === undefined || options.adslot.sizes === null) {
|
29
|
+
console.error("no adslot.sizes specified");
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
if (options.adslot.id === undefined || options.adslot.id === null) {
|
33
|
+
console.error("no adslot.id specified");
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
if (options.adwidth === undefined || options.adwidth === null) {
|
39
|
+
console.error("no adwidth specified");
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
|
43
|
+
if (options.adheight === undefined || options.adheight === null) {
|
44
|
+
console.error("no adheight specified");
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
var target = document.getElementById(options.element);
|
48
|
+
if (target === null || target === undefined) {
|
49
|
+
console.error("no target element not found");
|
50
|
+
return;
|
51
|
+
}
|
52
|
+
target.innerHTML = "";
|
53
|
+
var e = document.createElement("iframe");
|
54
|
+
e.setAttribute("frameBorder", "0");
|
55
|
+
e.setAttribute("scrolling", "no");
|
56
|
+
e.setAttribute("width", options.adwidth);
|
57
|
+
e.setAttribute("height", options.adheight);
|
58
|
+
e.setAttribute("vspace", "0");
|
59
|
+
e.setAttribute("hspace", "0");
|
60
|
+
e.setAttribute("allowTransparency", "true");
|
61
|
+
e.setAttribute("marginWidth", "0");
|
62
|
+
e.setAttribute("marginHeight", "0");
|
63
|
+
e.style.border = "none";
|
64
|
+
e.style.margin = "0px";
|
65
|
+
e.style.padding = "0px";
|
66
|
+
e.style.width = options.adwidth + "px";
|
67
|
+
e.style.height = options.adheight + "px";
|
68
|
+
target.appendChild(e);
|
69
|
+
var adslotsscript = "";
|
70
|
+
adslotsscript += "googletag.defineSlot('" + options.adslot.slot + "', " + options.adslot.sizes + ", '" + options.adslot.id + "').addService(googletag.pubads());";
|
71
|
+
var asyncDFP = "<scr" + "ipt>var googletag = googletag || {};" + "googletag.cmd = googletag.cmd || [];" + "var gads = document.createElement('script');" + "gads.async = true;" + "gads.type = 'text/javascript';" + "var useSSL = 'https:' == document.location.protocol;" + "gads.src = (useSSL ? 'https:' : 'http:') +" + " '//www.googletagservices.com/tag/js/gpt.js';" + "var node = document.getElementsByTagName('script')[0];" + "node.parentNode.insertBefore(gads, node);" + "googletag.cmd.push(function() {" + adslotsscript + " googletag.pubads().enableSingleRequest();" + " googletag.enableServices();" + "});</scr" + "ipt>";
|
72
|
+
var adSlot = "<scr" + "ipt>googletag.cmd.push(function() { googletag.display('" + options.adslot.id + "'); });</scr" + "ipt>";
|
73
|
+
var adSlotDiv = "<div id='" + options.adslot.id + "' style='width: " + options.adwidth + "px; height: " + options.adheight + "px;'></div>";
|
74
|
+
var dbf = "<html><head></head><body>" + asyncDFP + adSlotDiv + adSlot + "</body></html>";
|
75
|
+
if (e.contentWindow) {
|
76
|
+
e = e.contentWindow;
|
77
|
+
} else if (e.contentDocument) {
|
78
|
+
if (e.contentDocument.document) {
|
79
|
+
e = e.contentDocument.document;
|
80
|
+
} else {
|
81
|
+
e = e.contentDocument;
|
82
|
+
}
|
83
|
+
}
|
84
|
+
e.onerror = function(e) {
|
85
|
+
console.error(e);
|
86
|
+
};
|
87
|
+
if (e.document) {
|
88
|
+
e.document.open();
|
89
|
+
e.document.write(dbf);
|
90
|
+
e.document.close();
|
91
|
+
}
|
92
|
+
};
|
93
|
+
window.ViceView = ViceView;
|
94
|
+
}());
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: viceview-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan Folstad
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Show Double Click for Publishers (DFP) ads over https for single page
|
56
|
+
web apps
|
57
|
+
email:
|
58
|
+
- support@datememe.com
|
59
|
+
executables: []
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- LICENSE.txt
|
64
|
+
- README.md
|
65
|
+
- lib/viceview/rails.rb
|
66
|
+
- lib/viceview/rails/version.rb
|
67
|
+
- vendor/assets/javascripts/viceview.js
|
68
|
+
homepage: https://www.datememe.com
|
69
|
+
licenses:
|
70
|
+
- MIT
|
71
|
+
metadata: {}
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 2.2.2
|
89
|
+
signing_key:
|
90
|
+
specification_version: 4
|
91
|
+
summary: AdSense for Single Page Apps
|
92
|
+
test_files: []
|