blob: 9e83020a98c0e5333cb6365700c64fea7838c1ef [file] [log] [blame]
Rushabh Mehta3966f1d2012-02-23 12:35:32 +05301// ERPNext - web based ERP (http://erpnext.com)
2// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
Rushabh Mehta3a751e82012-01-27 18:00:14 +053017pscript.onload_unsubscribe = function(wrapper) {
18 var email = window.location.hash.split('/').splice(-1);
19 $(wrapper).find('input[name="unsubscribe"]').val(email)
20
21 $('#btn-unsubscribe').click(function() {
22 var email = $(wrapper).find('input[name="unsubscribe"]').val();
23 if(email) {
24 var btn = this;
25 wn.call({
26 module:'website',
27 page:'unsubscribe',
28 method:'unsubscribe',
29 args:email,
30 btn: this,
31 callback: function() {
32 $(wrapper).find('input[name="unsubscribe"]').val('');
33 }
34 });
35 }
36 });
37}