preview-datalet_old.html 4.66 KB
<!--
@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.
-->

<!--
* Developed by :
* ROUTE-TO-PA Project - grant No 645860. - www.routetopa.eu
*
-->

<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:

    <preview-datalet data-url="http://spod.routetopa.eu"
    </preview-datalet>


@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(){
                //this.$.base.setDomain(this.url.split("/")[0] + "//" + this.url.split("/")[2]);
            }
        });
    </script>
</dom-module>