Dottoro Theme Documentation

Tutorial to get your theme to work

PrologueFirst StepsFront PageCreating a custom front pageBlog, News and Portfolio post typesPost Type specific settingsGeneral settingsSingle post settingsCategory / Tag / Date archive page settingsPermalink settingsOptions on single post pagesGeneral page optionsImage optionsGallery settingsPage Templates and PagesPage SettingsPage TemplatesPages created from page templatesGeneral page settingsGallery settingsBlog page settingsNews page settingsPortfolio and Imagefolio page settingsContact page settingsArchives page settingsAuthors page settingsBoomarks page settingsSitemap page settingsSpecial pagesCategory and tag page settingsArchive and date page settingsSearch page settingsAuthor page settings404 page settingsHeader and MenuSubheadersSubheader specific shortcodesPredefined SubheadersCreating SubheadersAssigning subheaders to pagesFooterWidgets in the FooterCopyright and other notices in the FooterSidebarWidgets on the SidebarWidth and alignment of the sidebarWidget AreasWidgetsBreadcrumbShortcodesShortcodes In Alphabetical OrderShortcodes By CategoriesNested ShortcodesPost TemplatesOverlaysMedia and External MediaOverview of galleries, gallery listings and slideshowsGalleries and Gallery ListingsAbout Galleries In GeneralCreating And Managing Galleries[gallery_list] shortcodeSlideshows and Popup SlideshowsSlideshowsPopup SlideshowsSlideshow SettingsMost Often Used Slideshow OptionsAll Slideshow OptionsSlideshow Templates - Slideshow Specific ShortcodesStyling Guide For SlideshowsStyling Of Slideshow and Post TemplatesSlidesPopupsSelectorsWeb FontsGeneral Theme SettingsUser RolesExport / Import SettingsCreating theme designsLocalizationHeadingsChild ThemesCSS ClassesResponsive DesignCSS Extension JavaScript ToolkitJavaScript LibraryAction HooksFilter HooksCompatibility Issues
<

32. JavaScript Library

The Dottoro theme comes with a self-developed cross-browser JavaScript library written in native JavaScript. The main advantages of this library are:

Thanks for the several theme options provided by the theme, you rarely need to write JavaScript code, but in some cases it is unavoidable. That's why this section describes only the most often used methods and objects of the library. If you need more information, please feel free to ask in our Support Forum.

32.1 General methods

Dottoro.Ready method
Allows you to specify a function to execute when the document has been loaded. Of course, the Dottoro.Ready function can be called multiple times if you want to register more than one function.
Syntax:
Dottoro.Ready (handler);
Parameters
handler Required. Specifies the function to be called.
Return value: This method has no return value.

Dottoro.AddListener method
Allows you to register an event handler for a specified event that fires on a given object.
Syntax:
Dottoro.AddListener (event, handler, elem, args[, custom_arg1[, custom_arg2, ...]]);
Parameters
event Required. String that specifies the name of the event to listen for. For a complete list of events, see the page for Events in JavaScript (first column). This parameter is case sensitive!
handler Required. Specifies the event listener function to be called when the event occurs. When an event occurs, an event object is passed to the event handler as the first parameter, the elem (third parameter of the Dottoro.AddListener) as a second parameter, and the optional arguments of the Dottoro.AddListener function as the next parameters.
elem Required. Specifies the element to listen.
args Optional. An object that specifies the additional properties.
Possible members
capture Number that specifies whether the event needs to be captured or not. One of the following constants (values):
  • Dottoro.CAPTURE_NO (0) - Register the event handler for the bubbling phase.
  • Dottoro.CAPTURE_ELEM (1) - Register the event handler for the capturing phase.
  • Dottoro.CAPTURE_WINDOW (2) - Register the event handler for the capturing phase on the current window object.
  • Dottoro.CAPTURE_ALLWINDOW (3) - Register the event handler for the capturing phase on all window objects (the top window and its descendants)
Default is Dottoro.CAPTURE_NO.
priority Number that specifies the priority of the listener. Default is 10.
For backward compatibility, if args is not an object, it specifies the capture.
custom_arg1, custom_arg2, ... Optional arguments to pass to the event listener.
Return value: Returns an object that identifies the registered listener.

Dottoro.RemoveListener method
Removes an event listener that was registered earlier with the Dottoro.AddListener method.
Syntax:
Dottoro.RemoveListener (id);
Parameters
id Required. Specifies the identifier of the registered listener returned by the Dottoro.AddListener method.
Return value: This method has no return value.

Dottoro.GetElemsByClass method
Returns an array that contains all descendant elements of an element with the specified CSS class name(s).
Syntax:
Dottoro.GetElemsByClass (selector, holder);
Parameters
selector Required. String that specifies the space separated class names.
holder Required. Specifies the root element for the search.
Return value: Array that contains all descendant elements of the element with the specified CSS class name(s).

Dottoro.StopPropagation method
Disables the propagation of the event in the DOM hierarchy. This function is a cross-browser implementation of the stopPropagation JavaScript method.
Syntax:
Dottoro.StopPropagation (event);
Parameters
event Required. The event object that identifies the event.
Return value: This method has no return value.

Dottoro.PreventDefault method
Prevents the default action associated with an event from occurring. This function is a cross-browser implementation of the preventDefault JavaScript method.
Syntax:
Dottoro.PreventDefault (event);
Parameters
event Required. The event object that identifies the event.
Return value: Always returns false.

Dottoro.CancelEvent method
Totally cancels the event. Disables the propagation of the event in the DOM hierarchy and prevents the default action from occurring.
Syntax:
Dottoro.CancelEvent (event);
Parameters
event Required. The event object that identifies the event.
Return value: Always returns false.

Dottoro.GetClientWinWidth method
Retrieves the width of the browser window, in pixels.
Syntax:
Dottoro.GetClientWinWidth (doc);
Parameters
doc Optional. The document object of the window. If not specified, the current document will be used.
Return value: The width of the browser window, in pixels.

Dottoro.GetClientWinHeight method
Retrieves the height of the browser window, in pixels.
Syntax:
Dottoro.GetClientWinHeight (doc);
Parameters
doc Optional. The document object of the window. If not specified, the current document will be used.
Return value: The height of the browser window, in pixels.

Dottoro.GetDocScrollLeft method
Retrieves the number of pixels by which the contents of the document are scrolled to the left.
Syntax:
Dottoro.GetDocScrollLeft (doc);
Parameters
doc Optional. The document object. If not specified, the current document will be used.
Return value: The number of pixels by which the contents of the document are scrolled to the left.

Dottoro.GetDocScrollTop method
Retrieves the number of pixels by which the contents of the document are scrolled to the top.
Syntax:
Dottoro.GetDocScrollTop (doc);
Parameters
doc Optional. The document object. If not specified, the current document will be used.
Return value: The number of pixels by which the contents of the document are scrolled to the top.

Dottoro.GetDocScrollMax method
Returns the maximum number of pixels by which the contents of the document can be scrolled horizontally and vertically.
Syntax:
Dottoro.GetDocScrollMax (doc);
Parameters
doc Optional. The document object. If not specified, the current document will be used.
Return value: Object with two propeties: x and y, that specify maximum number of pixels by which the contents of the document can be scrolled horizontally and vertically.

32.2 Popup related methods and objects

DottoroWP.OpenPopup method
Opens a popup window with the specified popup id.
Syntax:
DottoroWP.OpenPopup (id, contentArgs, windowArgs, args);
Parameters
id Required. Specifies the post identifier of the popup. To get the identifier of a popup, open the edit popup page and look at the URL in the location bar of your browser. The URL contains a 'post=number' substring, where the number is the identifier.
contentArgs Optional. Allows you to pass name/value pairs to the popup. This argument must be a JavaScript object!
See Example 5 for details.
windowArgs Optional. Allows you to override the settings of the popup window. This argument must be a JavaScript object!
Possible options:
args Optional. Allows you to specify additional settings for the popup window. This argument must be a JavaScript object!
Possible options:
  • show - Boolean. Specifies whether the popup window should be shown or not. Default is true.
  • preloaderAnim - Boolean. Specifies whether to show a preloader animation while the popup is loading (true | false). Default is false.
  • instanceId - String. Specifies the instance identifier of the popup. If the instance id is not specified, the id (see first parameter above) will be the instance id. This option allows you to use the same popup for multiple instances. It is useful if you want to open the same popup window with different content arguments.
Return value: A Popup object that represents the opened popup window.

DottoroWP.ClosePopup method
Closes a popup window with the specified popup id.
Syntax:
DottoroWP.ClosePopup (id);
Parameters
id Required. Specifies the post identifier of the popup. Must be the same as the id used for opening the popup (see the id parameter of the DottoroWP.OpenPopup function above).
instanceId Specifies the instance id of the popup. This parameter only needs to be set if the instance id was specified when opening the popup (see the args parameter of the DottoroWP.OpenPopup function above).
Return value: This method has no return value.

DottoroWP.GetOwnerPopup method
Retrieves a Popup object representing the popup window from any HTML element of the popup.
Syntax:
DottoroWP.GetOwnerPopup (elem);
Parameters
elem Required. Specifies a HTML element in the popup window.
Return value: A Popup object that represents the popup window.

DottoroWP.Popup object
Represents a popup window.
How to create?
  • var popup = DottoroWP.OpenPopup (id, contentArgs, windowArgs);
Possible Members:
Methods:
  • Close ()
    Closes the popup window. The Action On Close option determines whether the popup window will be destroyed or hidden when closed.
    Return value: This method has no return value.
  • Show ()
    Shows the popup window.
    Return value: This method has no return value.
  • Hide ()
    Hides the popup window.
    Return value: This method has no return value.
  • Destroy ()
    Destroys the popup window.
    Return value: This method has no return value.
  • IsCreated ()
    Returns whether the popup window is created or not.
    Return value: Boolean that specifies whether the popup window is created or not.
  • IsVisible ()
    Returns whether the popup window is visible or not.
    Return value: Boolean that specifies whether the popup window is visible or not.
  • CancelAutoClose ()
    Cancels the automatic closing. The Auto Close option specifies the amount of time in milliseconds that the popup should remain visible before it hides. If this value is greater than 0, the popup window will be automatically hidden, but with the CancelAutoClose method, you can cancel this.
    Return value: This method has no return value.
  • MoveWindow (pos, moveIntoView)
    Moves the popup window to the specified position.
    Parameters
    pos Required. An object that specifies the positions.
    Examples:
    • {left: 23, top: 100}
    • {right: 0, top: 0}
    • {right: 50, bottom: 20}
    moveIntoView Optional. Specifies whether the popup window should be moved into the visible area of the browser view or not. Default is false.
    Return value: This method has no return value.
  • MoveIntoView ()
    Moves the popup window into the visible area of the browser view.
    Return value: This method has no return value.