Git Product home page Git Product logo

dialogpanel's Introduction

Greetings to all!

Immediately short:

This is a plugin for quick and easy creation of dialogs (modal windows) on your page.

Setup and using:

connect dialogPanel.css and dialogPanel.js after jQuery connecting.

creation:

$(element).dialogPanel("open", options);
//returns: $element

options:

//Type: Object
{
	dialogName:custom dialog name (if needed, default: ""),
	//Type: Object
	attr:{},
	//callback function, default: function(){}
	init:function($dialog_element,dialog_uid,properties_and_methods){
	
	},
	//Type: Array
	content:[
		component1,
		component2,
		component1,
		//....
	],
	//callback function, default: function(){}
	func:function(request){
		
	}
}

dialogName will be saved in "dialogname" attribute of modal window. In the future, this window can be found by using CSS Attribute Selectors. attr receives and apply attributes to dialog in the following format (in fact, this is jQuery.attr):

{
	attribute_name:value
}

init is a callback function that receives element, UID of dialog (not dialogName โ€” UID is stored in "uid" attribute and generated randomly) and object with all methods and properties

components:

//Type: Object
{
	type:componentType,
	arg1:...,
	//some args...
}

values:

type value info args args values
attr applies to the current component jQuery.attr (this arg there is in all components)
init callback: function($that_component,dialog_uid,properties_and_methods) (this arg there is in all components)
"message" display some text message (special characters (for example, \n) will be displayed normally) text some text
"button" add button in modal-window footer btntext some text
btnID text id of button
"textarea" or "input" displays an input or textarea and has the same arguments inpID text id of input or textarea
"select" displays select selID text id of select
options object: {value:... , text:...} where value is option value, text- displayed option text
"checkbox" displays checkbox chcID text id of checkbox
"custom" add div with width=100%
"uploader" add file selector uplID text id of uploader
accept allowed file types (same as input type=file)
multiple if true- allows multiple file selection
upltext the text that will initially be displayed on uploader

request:

//Type: Object
{
	pressed:btnID of pressed button,
	//Type: Object
	values:{
		inpID:input value
	},
	//Type: Object
	checked:{
		chcID:checkbox state - true/false
	},
	//Type: Object
	fileLists:{
		//Type: FileList
		uplID:files list
	}
}

Example:

jQuery("body").dialogPanel("open",{
	content:[{
		type:"message",
		text:"example message"
	},{
		type:"input",
		attr:{
			placeholder:"input text"
		},
		inpID:"ex"
	},{
		type:"message",
		text:"Did you enter the text?"
	},{
		type:"button",
		btntext:"ok",
		btnID:"ok"	
	},{
		type:"button",
		btntext:"cancel",
		btnID:"canc"	
	}],
	func:function(req){
		if(req.pressed!=="ok")
			return;
		alert(req.values.ex);
	}
});

dialogpanel's People

Contributors

milolug avatar

Stargazers

 avatar

Forkers

deawx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.