Backup of db before drupal security update
[yaffs-website] / web / core / modules / book / book.js
1 /**
2  * @file
3  * Javascript behaviors for the Book module.
4  */
5
6 (function ($, Drupal) {
7
8   'use strict';
9
10   /**
11    * Adds summaries to the book outline form.
12    *
13    * @type {Drupal~behavior}
14    *
15    * @prop {Drupal~behaviorAttach} attach
16    *   Attaches summary behavior to book outline forms.
17    */
18   Drupal.behaviors.bookDetailsSummaries = {
19     attach: function (context) {
20       $(context).find('.book-outline-form').drupalSetSummary(function (context) {
21         var $select = $(context).find('.book-title-select');
22         var val = $select.val();
23
24         if (val === '0') {
25           return Drupal.t('Not in book');
26         }
27         else if (val === 'new') {
28           return Drupal.t('New book');
29         }
30         else {
31           return Drupal.checkPlain($select.find(':selected').text());
32         }
33       });
34     }
35   };
36
37 })(jQuery, Drupal);