FANDOM


/*

Wikimarks Demo

More info at: http://wikimarks.wikia.com/Code

© Peter Coester, 2012

Module "Demo"

 */
 
 
/**
 *
 * IE: border ridge -> border solid
 *     radius 16px  -> radius 6px
 *
 */
 
(function (ns) {
 
    function createBrowserCheck () {
 
        var wikimarks = 'Wikim<span style="font-weight: smaller; line-height: 0.25em; font-size:2.25em;vertical-align:0; position: relative; top: 0.4em; opacity: 0.9;">*</span>rks';
 
        var browserCheck = Boolean(window.postMessage && window.localStorage && window.JSON);
 
        $('#browser-check')
        .empty().append(
            browserCheck
                ? '<p style="font-size: 1.1em; font-weight: bold;">Excellent!</p><p>Your browser fully supports '+wikimarks+'! :)</p>'
                : '<p style="font-size: 1.1em; font-weight: bold;">Sorry!</p><p>Your browser does not seem to support '+wikimarks+'! :(</p>'
        );
    }
 
    function createDemoButton () {
 
        $('#demo-button').add('#grayout').remove();
        $('#WikiaArticle').append('<input id="demo-button" type="button" value="Show me the Demo!" />');
 
        var initialState = {
            position: 'absolute',
            left: '575px',
            top: '320px',
            fontSize: '15px',
            width: '220px',
            height: '38px',
            lineHeight: '36px',
            zIndex: '1000'
        };
 
        var demoButton = $('#demo-button')
        .css(initialState)
        .one('click', function () {
 
            $(this).data('was-clicked', true);
 
            if (ns.Client) {
                alert('You already have Wikimarks installed :)');
                return;
            } else {
                //alert('The demo works on this page and on the editor page (Click the logo in the menu to get there)');
            }
 
            var w, h, l, t, s, button = $(this);
            var later = $.Deferred();
 
            //$.getScript('Client.js?action=raw&maxage=8600&smaxage=8600'
            window.setTimeout(function () {
                console.log(button);
                later.done(function () {
                    button
                    .removeClass('load')
                    //.css(initialState)
                    //.css('background-color', '#aea395 !important')
                    .attr('disabled', true)
                    ///*
                    .animate(initialState, 100, function () {
                        $('<div id="grayout"></div>')
                        .appendTo('#WikiaArticle')
                        .css(initialState)
                        .css({
                            borderRadius: '4px',
                            backgroundColor: '#fdd398',
                            zIndex: '1001',
                            opacity: '0.0'
                        })
                        .animate({ 
                            opacity: '0.8'
                        }, 300);
                    });
                });
                //*/
            }, 2000);
 
            w = parseInt($(this).css('width'), 10);
            h = parseInt($(this).css('height'), 10);
            l = parseInt($(this).css('left'), 10);
            t = parseInt($(this).css('top'), 10);
            s = parseInt($(this).css('font-size'), 10);
 
            button
            //*
            .animate({
                width: w + 15 + 'px',
                height: h + 5 + 'px',
                left: l - 2 + 'px',
                top: t - 2 + 'px',
                //fontSize: s + 1 + 'px'
            }, 100)
            //.delay(50)
            //*/
            .animate({
                width: Math.round(w/2) + 'px',
                height: Math.round(h/2) + 'px',
                left: Math.round(l + w/4) + 'px',
                top: Math.round(t + h/4) + 'px',
                fontSize: Math.round(s/2) + 'px',
                opacity: '0.25'
            }, 200, function () {
                $(this).addClass('load').css('opacity', '1.0');
                later.resolve();
            });            
        })
 
        .css('box-shadow', '0px 0px 6px 6px white')
        .data('white', true);
 
        var blink = function () {
            if (demoButton.data('was-clicked')) {
                demoButton.css('box-shadow', 'none')
                return;
            }
            var shadow =  demoButton.data('white') ? 'none' : '0px 0px 6px 6px white';
            demoButton
            .css('box-shadow', shadow)
            .data('white', !demoButton.data('white'));
            window.setTimeout(function () {
                blink();
            }, 600);
        }
 
        blink();
    }
 
    var demoPage = 0 === wgNamespaceNumber &&
        'Wikimarks Wiki'  === wgTitle && 'view' === wgAction;
 
    var demoEdit = 2 === wgNamespaceNumber &&
       '4show/Wikimarks' === wgTitle && 'view' === wgAction &&
        $.getUrlVar('demo');
 
    console.log(demoPage)
 
    if (!(demoPage || demoEdit)) return;
 
    /*
    if (demoPage) {
        createDemoButton();
        createBrowserCheck();
    }
    */
 
    ns.Demo = {
        isPage: function () { return demoPage; },
        isEdit: function () { return demoEdit; }
    };
 
}(window.Wikimarks = window.Wikimarks || {}));
 
//

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.