Socket
Socket
Sign inDemoInstall

jquery.dirtyforms.dialogs.facebox

Package Overview
Dependencies
3
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jquery.dirtyforms.dialogs.facebox

A module to enable automatic Facebox dialog support when using JQuery Dirty Forms.


Version published
Weekly downloads
12
increased by50%
Maintainers
1
Install size
1.42 MB
Created
Weekly downloads
 

Readme

Source

jquery-dirtyforms MyGet Build Status

Dirty Forms Logo

jquery.dirtyforms.dialogs.facebox

This is a dialog module for the jQuery Dirty Forms project.

Purpose

This module causes Dirty Forms to use Facebox as its dialog when the user attempts to leave the page by clicking a hyperlink (but not when interacting with the navigation buttons of the browser).

Only 1 dialog module can be used by Dirty Forms at a time. The default behavior without this package is to use the browser's built in dialog that is fired by the beforeunload event.

Prerequisites

Prerequesites must be included in this order:

  • jQuery (>= 1.4.2) - Stashing support for select elements requires jQuery >= 1.6
  • jquery.facebox (>= 1.4.1) - both the CSS and JS
  • jquery.dirtyforms (>= 1.0.0)

If you are using a Package Manager, these dependencies will be installed automatically, but depending on your environment you may still need to add references to them manually.

Download & Installation

There are several different ways to get the code. Some examples below:

CDN

The Facebox dialog module is available over jsDelivr CDN and can directly be included on every page.

<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.dirtyforms/2.0.0/jquery.dirtyforms.dialogs.facebox.min.js"></script>

jsDelivr also supports on-the-fly concatenation of files, so you can reference only 1 URL to get jQuery, jquery.facebox, jquery.dirtyforms, and jquery.dirtyforms.dialogs.facebox in one request.

<script type="text/javascript" src="//cdn.jsdelivr.net/g/jquery@1.11.3,jquery.facebox,jquery.dirtyforms@2.0.0(jquery.dirtyforms.min.js+jquery.dirtyforms.dialogs.facebox.min.js)"></script>
Self-Hosted

Download and save one of two available files to include the Facebox dialog module to your page, either the latest distribution or the latest minified version.

<script type="text/javascript" src="jquery.dirtyforms.dialogs.facebox.min.js"></script>

You can also conveniently get all of the latest Dirty Forms files in one Zip Download.

Package Managers

The Facebox dialog module is even available through NPM, Bower, and NuGet. Just use one of the following commands below to install the dialog module, including all dependencies.

NPM version Bower version NuGet version

NPM

// NPM
$ npm install jquery.dirtyforms.dialogs.facebox

// Bower
$ bower install jquery.dirtyforms.dialogs.facebox

// NuGet
PM> Install-Package jquery.dirtyforms.dialogs.facebox

SourceMaps

A SourceMap file is also available via CDN or your favorite package manager.

CDN
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.dirtyforms/2.0.0/jquery.dirtyforms.dialogs.facebox.min.js.map"></script>
Package Managers

NPM, Bower, and NuGet will install the SourceMap file into the destination directory.

jquery.dirtyforms.dialogs.facebox.min.js.map

Usage

This dialog module is automatic. Simply include the reference to the dialog module after the prerequisites and use Dirty Forms as per the documentation and Facebox as per the documentation.

// CSS
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.facebox/latest/jquery.facebox.min.css" />

// JavaScript
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js" type="text/javascript"></script>
<script src="//cdn.jsdelivr.net/jquery.facebox/latest/jquery.facebox.min.js" type="text/javascript"></script>
<script src="//cdn.jsdelivr.net/jquery.dirtyforms/2.0.0/jquery.dirtyforms.min.js" type="text/javascript"></script>
<script src="//cdn.jsdelivr.net/jquery.dirtyforms/2.0.0/jquery.dirtyforms.dialogs.facebox.min.js" type="text/javascript"></script>

If not using a CDN, you need to apply the dependencies in the same order as in the example above.

Options

The following options are available to set via $.DirtyForms.dialog.OPTIONNAME = OPTIONVALUE or get via OPTIONVALUE = $.DirtyForms.dialog.OPTIONNAME

NameTypeDefaultDescription
titlestring'Are you sure you want to do that?'Sets the title of the dialog.
proceedButtonClassstring''Sets the CSS class of the continue button of the dialog (an HTML anchor tag element).
proceedButtonTextstring'Leave This Page'Sets the text of the continue button of the dialog.
stayButtonClassstring''Sets the CSS class of the cancel button of the dialog (an HTML anchor tag element).
stayButtonTextstring'Stay Here'Sets the text of the cancel button of the dialog.
stashSelectorstring'#facebox .content'When using stashing, setting this selector chooses the element of the modal dialog containing your form that will be included in the stash and later restored during unstash (if the user clicks cancel).

For information about stashing, see the Modal Dialog Stashing section.

Support

For help or to report a bug please open an issue at the Dirty Forms development site.

Keywords

FAQs

Last updated on 30 Jan 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc