Blame view

datalets/preview-datalet/preview-datalet.html 4.66 KB
035bbee3   Luigi Serra   Datalets and cont...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  <!--

  @license

      The MIT License (MIT)

  

      Copyright (c) 2015 Dipartimento di Informatica - Università di Salerno - Italy

  

      Permission is hereby granted, free of charge, to any person obtaining a copy

      of this software and associated documentation files (the "Software"), to deal

      in the Software without restriction, including without limitation the rights

      to use, copy, modify, merge, publish, distribute, sublicense, and/or sell

      copies of the Software, and to permit persons to whom the Software is

      furnished to do so, subject to the following conditions:

  

      The above copyright notice and this permission notice shall be included in

      all copies or substantial portions of the Software.

  

      THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

      IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

      FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

      AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

      LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,

      OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN

      THE SOFTWARE.

  -->

ae17a8dc   Luigi Serra   Controllet and da...
25
26
  

  <!--

950d181d   Luigi Serra   license updates
27
28
  * Developed by :

  * ROUTE-TO-PA Project - grant No 645860. - www.routetopa.eu

ae17a8dc   Luigi Serra   Controllet and da...
29
30
31
  *

  -->

  

035bbee3   Luigi Serra   Datalets and cont...
32
33
34
35
36
37
38
  <link rel="import" href="../base-datalet/base-datalet.html">

  

  <!--

  `preview-datalet` is a datalet that allow user to preview the content of a web page. It creates a thumbnail of the site using the data-url attribute passed as input.

  

  Example:

  

eb240478   Luigi Serra   public room cards...
39
40
      <preview-datalet data-url="http://spod.routetopa.eu"

      </preview-datalet>

035bbee3   Luigi Serra   Datalets and cont...
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
  

  

  @element preview-datalet

  @status beta

  @homepage

  @group datalets

  -->

  

  <dom-module id="preview-datalet">

      <template>

          <style is="custom-style">

              .content {

                  /*width: 50%;*/

                  margin: 0px auto;

              }

  

              .embed-container {

                  height: 0;

                  /*width: 100vw;*/

                  padding-bottom: 56.25%;

                  overflow: hidden;

                  position: relative;

  

  

              }

  

              .embed-container iframe {

                  width: 100%;

                  height: 100%;

                  position: absolute;

                  top: 0;

                  left: 0;

              }

          </style>

          <div class="content">

              <a href="{{url}}" target="_blank">{{url}}</a>

              <div class="embed-container" style="height:300px;padding:0px;overflow:hidden;">

                  <iframe style="zoom:0.75;

                                  width:1280px;

                                  height:786px;

                                  border:none;

                                  -ms-transform: scale(0.50);

                                  -moz-transform: scale(0.50);

                                  -o-transform: scale(0.50);

                                  -webkit-transform: scale(0.50);

                                  transform: scale(0.50);

                                  -ms-transform-origin: 0 0;

                                  -moz-transform-origin: 0 0;

                                  -o-transform-origin: 0 0;

                                  -webkit-transform-origin: 0 0;

                                  transform-origin: 0 0;"

                                   src="{{url}}"

                                   scrolling="yes">

                  </iframe>

              </div>

          </div>

  

          <base-datalet id="base" data-url="{{dataUrl}}"></base-datalet>

  

      </template>

  

      <script>

  

          Polymer({

              is : 'preview-datalet',

  

              properties: {

                  /**

                   * It's the url for the preview

                   *

                   * @attribute url

                   * @type Strig

                   * @default ''

                   */

                  url : {

                      type : String,

                      value : ""

                  }

              },

  

              /**

               * It is called after the element’s template has been stamped and all elements inside the element’s local

               * DOM have been configured (with values bound from parents, deserialized attributes, or else default values)

               * and had their ready method called.

               *

               * Extract the dataset domain from the entire URL and set the text content of the datalet footer.

               *

               * @method ready

               *

               */

              ready: function(){

ca817ac6   isisadmin   private room updates
132
                  //this.$.base.setDomain(this.url.split("/")[0] + "//" + this.url.split("/")[2]);

035bbee3   Luigi Serra   Datalets and cont...
133
134
135
136
137
              }

          });

      </script>

  </dom-module>