Difference between revisions of "User:Podehaye/common.js"

From Wikibase Personal data
Jump to navigation Jump to search
Line 7: Line 7:
  
 
mw.notify( $('<span>storge</span>') );
 
mw.notify( $('<span>storge</span>') );
−
 
−
// Button:
 
−
mw.loader.using( 'oojs-ui-core' ).done( function () {
 
−
$( function () {
 
−
var key = new OO.ui.TextInputWidget( {
 
−
placeholder: 'key'
 
−
} ),
 
−
            value = new OO.ui.TextInputWidget( {
 
−
placeholder: 'value'
 
−
} ),
 
−
            save = new OO.ui.ButtonWidget( {
 
−
                        label: 'save'
 
−
                } ),
 
−
            show = new OO.ui.ButtonWidget( {
 
−
                        label: 'show'
 
−
                } ),
 
−
            info = new OO.ui.LabelWidget( {
 
−
label: 'label'
 
−
} );
 
−
 
−
 
−
save.on( 'click', function () {
 
−
            mw.cookie.set( key.getValue(), value.getValue() )});
 
−
       
 
−
show.on( 'click', function () {
 
−
            info.setLabel(mw.cookie.get(key.getValue()))});
 
−
 
−
 
−
// Append the app widgets
 
−
  $( '#mw-content-text' ).prepend(
 
−
//                "hello",
 
−
                key.$element,
 
−
                value.$element,
 
−
                save.$element,
 
−
                show.$element,
 
−
                info.$element
 
−
);
 
−
 
−
} );
 
−
 
−
} );
 
−
 
−
<br/>
 

Revision as of 01:33, 18 May 2019

mw.notify( $('<span>Welcome, Paul, your <a href="https://wiki.personaldata.io/wiki/User:Podehaye/common.js">user script</a> is loading!</span>') );

mw.loader.load( '//wiki.personaldata.io/w/index.php?title=User:Podehaye/button.js&action=raw&ctype=text/javascript' ); // front button for testing
mw.loader.load( '//wiki.personaldata.io/w/index.php?title=User:Podehaye/store.js&action=raw&ctype=text/javascript' ); // storage form for testing
mw.notify( $('<span>done common</span>') );


mw.notify( $('<span>storge</span>') );