WP Dashboard Notes - Version 1.0.7

Version Description

  • 11/12/2015 =

  • Fix/Improvement - Move 'Add note' button to the admin bar

  • Add - Full WP 4.4 compatibility

  • Improvement - Improve some JS

Download this release

Release Info

Developer sormano
Plugin Icon 128x128 WP Dashboard Notes
Version 1.0.7
Comparing to
See all releases

Version 1.0.7

assets/css/wp-dashboard-notes-admin.min.css ADDED
@@ -0,0 +1 @@
 
1
+ input[type=text].add-list-item{line-height:normal;border-radius:3px;height:35px;padding:5px 10px;width:75%;border-color:#555;background-color:rgba(255,255,255,0.6)}input[type=text].add-list-item::-webkit-input-placeholder{color:#555}input[type=text].add-list-item:-moz-placeholder{color:#555}input[type=text].add-list-item::-moz-placeholder{color:#555}input[type=text].add-list-item:-ms-input-placeholder{color:#555}.wp-dashboard-note{line-height:1.5;font-size:14px;min-height:30px}.wp-dashboard-note-wrap{padding-bottom:40px}.wp-dashboard-note-options{text-align:left}.list-note .wp-dashboard-note-options{margin-top:15px}.wp-dashboard-note .list-item{min-height:30px;line-height:30px;width:100%;display:block}.wp-dashboard-note div:last-child{border-bottom:0}.wpdn-note-sortable{color:#6f6f6f;margin-right:5px;cursor:move;line-height:inherit;opacity:0}.list-item:hover .wpdn-note-sortable{opacity:1}.list-item .dashicons-no-alt{color:rgba(0,0,0,0.3);text-align:right;float:right;cursor:pointer;line-height:inherit}.list-item input[type=checkbox]{margin-right:15px;background:transparent;border-color:#555}.list-item input[type=checkbox]:checked:before{color:#555}.list-item input[type=checkbox]:checked ~ span{text-decoration:line-through;color:#6f6f6f}.list-item .dashicons-no-alt:hover{color:#999}.list-item:hover .dashicons-no-alt{visibility:visible}.list-item .dashicons-no-alt{visibility:hidden}.wp-dashboard-note-wrap .wpdn-add-item{line-height:2}.list-item .wpdn-add-item{color:#ccc;margin-right:8px}.list-item-content{line-height:1}.wp-dashboard-note-wrap:hover .wpdn-extra{opacity:1}.wpdn-extra{background:rgba(76,76,76,0.9);position:absolute;opacity:0;width:100%;left:0;bottom:0;height:40px;padding-left:12px;box-sizing:border-box;-webkit-transition:opacity 0.3s ease-in-out;transition:opacity 0.2s ease-in-out}.wpdn-extra *{color:#fff}.wpdn-extra .dashicons:hover{color:#ccc;cursor:pointer}[data-note-type=list] .saved-icon .dashicons,.wpdn-extra .dashicons{line-height:2}.wpdn-extra .dashicons{margin-left:5px}[data-note-type=regular] .saved-icon .dashicons{line-height:1}.hndle span{cursor:text;-webkit-user-select:text;-moz-user-select:text;-ms-user-select:text;-o-user-select:text;user-select:text}.hndle .wpdn-edit-title{display:none;height:19px;color:#222;cursor:pointer;margin-left:5px}.hndle:hover .dashicons{display:inline-block}[id^=note_] .handlediv{color:#222;color:transparent}.wp-dashboard-note-wrap a{position:relative}.wp-dashboard-note-wrap :focus{outline:none}.link-hover{background:rgba(76,76,76,0.9);position:absolute;left:0px;top:1.6em;padding:5px;border-radius:4px;font-size:12px;z-index:99;min-width:55px;text-align:center}.link-hover a{color:white}.hndle .status{float:right}.saving-icon img{vertical-align:middle}.saved-icon,.saving-icon{color:#222;font-weight:normal;font-size:13px}.metabox-prefs .wpdn-edit-title.dashicons-edit{display:none}span.wpdn-color-note:hover .wpdn-color-palette{display:inline-block}.wpdn-color-palette{min-width:50px;width:auto;padding:4px 8px 2px 8px;margin-left:-8px;position:absolute;top:-24px;background-color:rgba(76,76,76,0.9);height:18px;display:none}.color{width:10px;height:10px;border:1px solid transparent;margin:2.5px;display:inline-block}.color:hover{border:1px solid #ccc;cursor:pointer}.color-white{background-color:#ffffff}.color-red{background-color:#f7846a}.color-orange{background-color:#ffbd22}.color-yellow{background-color:#eeee22}.color-blue{background-color:#66ccdd}.color-green{background-color:#bbe535}.color-black{background-color:#777777}[data-color-text=black]{color:white}[data-color-text=black] .wpdn-note-sortable{color:white}[data-color-text=black] .wpdn-add-item{color:white}[data-color-text=black] .wp-dashboard-note .list-item{border-color:white}[data-color-text=black] input[type=checkbox]{border:1px solid white}[data-color-text=black] .list-item input[type=checkbox]:checked ~ span{color:white}[data-color-text=black] [id^=note] .handlediv{color:white}[data-color-text=black] input[type=text].add-list-item{border-color:#FFF;color:#FFF;background:rgba(255,255,255,0.3)}[data-color-text=black] input[type=text].add-list-item::-webkit-input-placeholder{color:white}[data-color-text=black] input[type=text].add-list-item:-moz-placeholder{color:white}[data-color-text=black] input[type=text].add-list-item::-moz-placeholder{color:white}[data-color-text=black] input[type=text].add-list-item:-ms-input-placeholder{color:white}[data-color-text=black] .saved-icon,[data-color-text=black] .saving-icon{color:white}[data-color-text=template]{color:inherit}[data-color-text=template] .wpdn-note-sortable{color:inherit}[data-color-text=template] .wpdn-add-item{color:inherit}[data-color-text=template] .wp-dashboard-note .list-item{border-color:inherit}[data-color-text=template] input[type=checkbox]{border:1px solid inherit}[data-color-text=template] .list-item input[type=checkbox]:checked ~ span{color:inherit}[data-color-text=template] [id^=note] .handlediv{color:inherit}[data-color-text=template] input[type=text].add-list-item{border-color:inherit;color:inherit;background:inherit}[data-color-text=template] input[type=text].add-list-item::-webkit-input-placeholder{color:inherit}[data-color-text=template] input[type=text].add-list-item:-moz-placeholder{color:inherit}[data-color-text=template] input[type=text].add-list-item::-moz-placeholder{color:inherit}[data-color-text=template] input[type=text].add-list-item:-ms-input-placeholder{color:inherit}[data-color-text=template] .saved-icon,[data-color-text=template] .saving-icon{color:inherit}
assets/css/wp-dashboard-notes-admin.scss ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ input[type=text].add-list-item {
2
+ line-height: normal;
3
+ border-radius: 3px;
4
+ height: 35px;
5
+ padding: 5px 10px;
6
+ width: 75%;
7
+ border-color: #555;
8
+ background-color: rgba( 255, 255, 255, 0.6 );
9
+ }
10
+
11
+ input[type=text].add-list-item::-webkit-input-placeholder {
12
+ color: #555;
13
+ }
14
+ input[type=text].add-list-item:-moz-placeholder {
15
+ color: #555;
16
+ }
17
+ input[type=text].add-list-item::-moz-placeholder {
18
+ color: #555;
19
+ }
20
+ input[type=text].add-list-item:-ms-input-placeholder {
21
+ color: #555;
22
+ }
23
+
24
+ .wp-dashboard-note {
25
+ line-height: 1.5;
26
+ font-size: 14px;
27
+ min-height: 30px;
28
+ }
29
+ .wp-dashboard-note-wrap {
30
+ padding-bottom: 40px;
31
+ }
32
+
33
+ .wp-dashboard-note-options {
34
+ text-align: left;
35
+ }
36
+ .list-note .wp-dashboard-note-options {
37
+ margin-top: 15px;
38
+ }
39
+
40
+ .wp-dashboard-note .list-item {
41
+ min-height: 30px;
42
+ line-height: 30px;
43
+ width: 100%;
44
+ display: block;
45
+ }
46
+ .wp-dashboard-note div:last-child {
47
+ border-bottom: 0;
48
+ }
49
+
50
+ /* Sortable */
51
+ .wpdn-note-sortable {
52
+ color: #6f6f6f;
53
+ margin-right: 5px;
54
+ cursor: move;
55
+ line-height: inherit;
56
+ opacity: 0;
57
+ }
58
+ .list-item:hover .wpdn-note-sortable {
59
+ opacity: 1;
60
+ }
61
+ .list-item .dashicons-no-alt {
62
+ color: rgba( 0, 0, 0, 0.3 );
63
+ text-align: right;
64
+ float: right;
65
+ cursor: pointer;
66
+ line-height: inherit;
67
+ }
68
+ .list-item input[type=checkbox] {
69
+ margin-right: 15px;
70
+ background: transparent;
71
+ border-color: #555;
72
+ }
73
+ .list-item input[type=checkbox]:checked:before {
74
+ color: #555;
75
+ }
76
+ .list-item input[type=checkbox]:checked ~ span {
77
+ text-decoration:line-through;
78
+ color: #6f6f6f;
79
+ }
80
+ .list-item .dashicons-no-alt:hover {
81
+ color: #999;
82
+ }
83
+ .list-item:hover .dashicons-no-alt {
84
+ visibility: visible;
85
+ }
86
+ .list-item .dashicons-no-alt {
87
+ visibility: hidden;
88
+ }
89
+ .wp-dashboard-note-wrap .wpdn-add-item {
90
+ line-height: 2;
91
+ }
92
+ .list-item .wpdn-add-item {
93
+ color: #ccc;
94
+ margin-right: 8px;
95
+ }
96
+ .list-item-content {
97
+ line-height: 1;
98
+ }
99
+
100
+ .wp-dashboard-note-wrap:hover .wpdn-extra {
101
+ opacity: 1;
102
+ }
103
+ .wpdn-extra {
104
+ background: rgba( 76, 76, 76, 0.9 );
105
+ position: absolute;
106
+ opacity: 0;
107
+ width: 100%;
108
+ left: 0;
109
+ bottom: 0;
110
+ height: 40px;
111
+ padding-left: 12px;
112
+ box-sizing: border-box;
113
+ -webkit-transition: opacity 0.3s ease-in-out;
114
+ transition: opacity 0.2s ease-in-out;
115
+ }
116
+ .wpdn-extra * {
117
+ color: #fff;
118
+ }
119
+ .wpdn-extra .dashicons:hover {
120
+ color: #ccc;
121
+ cursor: pointer;
122
+ }
123
+ [data-note-type=list] .saved-icon .dashicons,
124
+ .wpdn-extra .dashicons {
125
+ line-height: 2;
126
+ }
127
+ .wpdn-extra .dashicons {
128
+ margin-left: 5px;
129
+ }
130
+ [data-note-type=regular] .saved-icon .dashicons {
131
+ line-height: 1;
132
+ }
133
+ .hndle span {
134
+ cursor: text;
135
+ -webkit-user-select: text;
136
+ -moz-user-select: text;
137
+ -ms-user-select: text;
138
+ -o-user-select: text;
139
+ user-select: text;
140
+ }
141
+ .hndle .wpdn-edit-title {
142
+ display: none;
143
+ height: 19px;
144
+ color: #222;
145
+ cursor: pointer;
146
+ margin-left: 5px;
147
+ }
148
+ .hndle:hover .dashicons {
149
+ display: inline-block;
150
+ }
151
+ [id^=note_] .handlediv {
152
+ color: #222;
153
+ color: transparent;
154
+ }
155
+
156
+ /* Open Link */
157
+ .wp-dashboard-note-wrap a {
158
+ position: relative;
159
+ }
160
+ .wp-dashboard-note-wrap :focus {
161
+ outline: none;
162
+ }
163
+ .link-hover {
164
+ background: rgba(76, 76, 76, 0.9);
165
+ position: absolute;
166
+ left: 0px;
167
+ top: 1.6em;
168
+ padding: 5px;
169
+ border-radius: 4px;
170
+ font-size: 12px;
171
+ z-index: 99;
172
+ min-width: 55px;
173
+ text-align: center;
174
+ }
175
+ .link-hover a {
176
+ color: white;
177
+ }
178
+
179
+ /* Saving */
180
+ .hndle .status {
181
+ float: right;
182
+ }
183
+ .saving-icon img {
184
+ vertical-align: middle;
185
+ }
186
+ .saved-icon,
187
+ .saving-icon {
188
+ color: #222;
189
+ font-weight: normal;
190
+ font-size: 13px;
191
+ }
192
+
193
+ /* Hide pencil at screen options titles */
194
+ .metabox-prefs .wpdn-edit-title.dashicons-edit {
195
+ display: none;
196
+ }
197
+
198
+ /****************************
199
+ * Colors
200
+ ****************************/
201
+ span.wpdn-color-note:hover .wpdn-color-palette {
202
+ display: inline-block;
203
+ }
204
+ .wpdn-color-palette {
205
+ min-width: 50px;
206
+ width: auto;
207
+ padding: 4px 8px 2px 8px;
208
+ margin-left: -8px;
209
+ position: absolute;
210
+ top: -24px;
211
+ background-color: rgba(76, 76, 76, 0.9);
212
+ height: 18px;
213
+ display: none;
214
+ }
215
+
216
+ .color {
217
+ width: 10px;
218
+ height: 10px;
219
+ border: 1px solid transparent;
220
+ margin: 2.5px;
221
+ display: inline-block;
222
+ }
223
+ .color:hover {
224
+ border: 1px solid #ccc;
225
+ cursor: pointer;
226
+ }
227
+ .color-white { background-color: #ffffff; }
228
+ .color-red { background-color: #f7846a; }
229
+ .color-orange { background-color: #ffbd22; }
230
+ .color-yellow { background-color: #eeee22; }
231
+ .color-blue { background-color: #66ccdd; }
232
+ .color-green { background-color: #bbe535; }
233
+ .color-black { background-color: #777777; }
234
+
235
+ /****************************
236
+ * Black
237
+ ****************************/
238
+ [data-color-text=black] {
239
+ color: white;
240
+ }
241
+ [data-color-text=black] .wpdn-note-sortable {
242
+ color: white;
243
+ }
244
+ [data-color-text=black] .wpdn-add-item {
245
+ color: white;
246
+ }
247
+ [data-color-text=black] .wp-dashboard-note .list-item {
248
+ border-color: white;
249
+ }
250
+ [data-color-text=black] input[type=checkbox] {
251
+ border: 1px solid white;
252
+ }
253
+ [data-color-text=black] .list-item input[type=checkbox]:checked ~ span {
254
+ color: white;
255
+ }
256
+ [data-color-text=black] [id^=note] .handlediv {
257
+ color: white;
258
+ }
259
+ [data-color-text=black] input[type=text].add-list-item {
260
+ border-color: #FFF;
261
+ color: #FFF;
262
+ background: rgba(255, 255, 255, 0.3);
263
+ }
264
+ [data-color-text=black] input[type=text].add-list-item::-webkit-input-placeholder {
265
+ color: white;
266
+ }
267
+ [data-color-text=black] input[type=text].add-list-item:-moz-placeholder {
268
+ color: white;
269
+ }
270
+ [data-color-text=black] input[type=text].add-list-item::-moz-placeholder {
271
+ color: white;
272
+ }
273
+ [data-color-text=black] input[type=text].add-list-item:-ms-input-placeholder {
274
+ color: white;
275
+ }
276
+ [data-color-text=black] .saved-icon,
277
+ [data-color-text=black] .saving-icon {
278
+ color: white;
279
+ }
280
+
281
+
282
+
283
+ /****************************
284
+ * Template
285
+ ****************************/
286
+ [data-color-text=template] {
287
+ color: inherit;
288
+ }
289
+ [data-color-text=template] .wpdn-note-sortable {
290
+ color: inherit;
291
+ }
292
+ [data-color-text=template] .wpdn-add-item {
293
+ color: inherit;
294
+ }
295
+ [data-color-text=template] .wp-dashboard-note .list-item {
296
+ border-color: inherit;
297
+ }
298
+ [data-color-text=template] input[type=checkbox] {
299
+ border: 1px solid inherit;
300
+ }
301
+ [data-color-text=template] .list-item input[type=checkbox]:checked ~ span {
302
+ color: inherit;
303
+ }
304
+ [data-color-text=template] [id^=note] .handlediv {
305
+ color: inherit;
306
+ }
307
+ [data-color-text=template] input[type=text].add-list-item {
308
+ border-color: inherit;
309
+ color: inherit;
310
+ background: inherit;
311
+ }
312
+ [data-color-text=template] input[type=text].add-list-item::-webkit-input-placeholder {
313
+ color: inherit;
314
+ }
315
+ [data-color-text=template] input[type=text].add-list-item:-moz-placeholder {
316
+ color: inherit;
317
+ }
318
+ [data-color-text=template] input[type=text].add-list-item::-moz-placeholder {
319
+ color: inherit;
320
+ }
321
+ [data-color-text=template] input[type=text].add-list-item:-ms-input-placeholder {
322
+ color: inherit;
323
+ }
324
+ [data-color-text=template] .saved-icon,
325
+ [data-color-text=template] .saving-icon {
326
+ color: inherit;
327
+ }
assets/js/wp-dashboard-notes-admin.js ADDED
@@ -0,0 +1,244 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function($) {
2
+
3
+ var loading_icon = '<span class="saving-icon"><img src="images/wpspin_light.gif"/> saving...</span>';
4
+ var saved_icon = '<span class="saved-icon"><div class="dashicons dashicons-yes"></div> saved!</span>';
5
+
6
+
7
+ // Add list item
8
+ $( 'body, .list-item-content' ).on( 'keydown', '.add-list-item', function( e ) {
9
+
10
+ if( e.keyCode == 13 && $( this ).val() != '' ) {
11
+
12
+ var post_id = $( this ).closest( ".postbox" ).attr( 'id' );
13
+ var list_item = '<div class="list-item"><div class="dashicons dashicons-menu wpdn-note-sortable"></div><input type="checkbox"><span class="list-item-content" contenteditable="true">' + $( this ).val() + '</span><div class="delete-item dashicons dashicons-no-alt"></div></div>';
14
+
15
+ $( '#' + post_id + ' div.wp-dashboard-note' ).append( list_item );
16
+ $( this ).val( '' ); // Clear 'add item' field
17
+ $( this ).trigger( 'note-sortable' );
18
+
19
+ $( this ).trigger( 'wpdn-update', this );
20
+
21
+ }
22
+
23
+ });
24
+
25
+
26
+ // Delete list item
27
+ $( document.body ).on( 'click', '.delete-item', function() {
28
+
29
+ var post_id = $( this ).closest( ".postbox" ).attr( 'id' );
30
+
31
+ $( this ).parent( '.list-item' ).remove();
32
+ $( document.body ).trigger( 'wpdn-update', ['', post_id] );
33
+
34
+ });
35
+
36
+
37
+ // Toggle visibility
38
+ $( document.body ).on( 'click', '.wpdn-visibility', function() {
39
+
40
+ $( this ).toggleClass( 'dashicons-admin-users dashicons-groups' );
41
+
42
+ var visibility = $( this ).parent().attr( 'data-visibility' );
43
+ if ( 'public' == visibility ) {
44
+ $( this ).parent( '.wpdn-toggle-visibility' ).attr( 'data-visibility', 'private' );
45
+ $( this ).parent( '.wpdn-toggle-visibility' ).attr( 'title', 'Visibility: Just me' );
46
+ } else {
47
+ $( this ).parent( '.wpdn-toggle-visibility' ).attr( 'data-visibility', 'public' );
48
+ $( this ).parent( '.wpdn-toggle-visibility' ).attr( 'title', 'Visibility: Everyone' );
49
+ }
50
+
51
+ $( this ).trigger( 'wpdn-update', this );
52
+
53
+ });
54
+
55
+
56
+ // Toggle note type
57
+ $( document.body ).on( 'click', '.wpdn-note-type', function() {
58
+
59
+ $( this ).toggleClass( 'dashicons-list-view dashicons-welcome-write-blog' );
60
+
61
+ var note_type = $( this ).closest( '[data-note-type]' ).attr( 'data-note-type' );
62
+ if ( note_type == 'regular' ) {
63
+ $( this ).closest( '[data-note-type]' ).attr( 'data-note-type', 'list' );
64
+ } else {
65
+ $( this ).closest( '[data-note-type]' ).attr( 'data-note-type', 'regular' );
66
+ }
67
+
68
+ var data = {
69
+ action: 'wpdn_toggle_note',
70
+ post_id: $( this ).closest( ".postbox" ).attr( 'id' ).replace( 'note_', '' ),
71
+ note_type: ( note_type == 'regular' ? 'list' : 'regular' )
72
+ };
73
+
74
+ $.post( ajaxurl, data, function( response ) {
75
+ $( '#note_' + data.post_id + ' .inside' ).html( response ).trigger( 'note-sortable' );;
76
+ });
77
+
78
+ $( this ).trigger( 'wpdn-update', this );
79
+
80
+ });
81
+
82
+
83
+ // Update note trigger
84
+ $( document.body ).on( 'wpdn-update', function( event, t, post_id ) {
85
+
86
+ if ( t != '' ) {
87
+ post_id = $( t ).closest( ".postbox" ).attr( 'id' );
88
+ }
89
+
90
+ if ( ! post_id ) {
91
+ return;
92
+ }
93
+
94
+ $( '#' + post_id + ' .hndle .status' ).html( loading_icon );
95
+ var data = {
96
+ action: 'wpdn_update_note',
97
+ post_id: post_id.replace( 'note_', '' ),
98
+ post_content: $( '#' + post_id + ' div.wp-dashboard-note' ).html(),
99
+ post_title: $( '#' + post_id + ' > .hndle .wpdn-title' ).html(),
100
+ note_visibility: $( '#' + post_id + ' [data-visibility]' ).attr( 'data-visibility' ),
101
+ note_color_text: $( '#' + post_id + ' [data-color-text]' ).attr( 'data-color-text' ),
102
+ note_color: $( '#' + post_id + ' [data-note-color]' ).attr( 'data-note-color' ),
103
+ note_type: $( '#' + post_id + ' [data-note-type]' ).attr( 'data-note-type' )
104
+ };
105
+
106
+ $.post( ajaxurl, data, function( response ) {
107
+ $( '#' + post_id + ' .hndle .status' ).html( saved_icon );
108
+ $( '#' + post_id + ' .hndle .status *' ).fadeOut( 1000, function() { $( this ).html( '' ) });
109
+ });
110
+
111
+ });
112
+
113
+
114
+ // Delete note
115
+ $( document.body ).on( 'click', '.wpdn-delete-note', function() {
116
+
117
+ var post_id = $( this ).closest( ".postbox" ).attr( 'id' );
118
+
119
+ $( '#' + post_id ).slideUp( 500, function() { $( this ).remove() } );
120
+
121
+ var data = {
122
+ action: 'wpdn_delete_note',
123
+ post_id: post_id.replace( 'note_', '' ),
124
+ };
125
+ $.post( ajaxurl, data );
126
+
127
+ });
128
+
129
+
130
+ // Add note
131
+ $( document.body ).on( 'click', '.wpdn-add-note, #wp-admin-bar-wpdn-add-note a', function( e ) {
132
+
133
+ var data = { action: 'wpdn_add_note' };
134
+
135
+ $.post( ajaxurl, data, function( response ) {
136
+ response = jQuery.parseJSON( response );
137
+ jQuery( '#postbox-container-1 #normal-sortables' ).append( response.note );
138
+ jQuery('body, html').animate({ scrollTop: $( "#note_" + response.post_id ).offset().top - 50 }, 750); // scroll down
139
+ jQuery( '#note_' + response.post_id + ' .add-list-item' ).focus();
140
+ });
141
+
142
+ // Stop scrollTop animation on user scroll
143
+ $( 'html, body' ).bind("scroll mousedown DOMMouseScroll mousewheel keyup", function( e ){
144
+ if ( e.which > 0 || e.type === "mousedown" || e.type === "mousewheel") {
145
+ $( 'html, body' ).stop().unbind('scroll mousedown DOMMouseScroll mousewheel keyup');
146
+ }
147
+ });
148
+
149
+ e.preventDefault();
150
+
151
+ });
152
+
153
+ // Change color
154
+ $( document.body ).on( 'click', '.color', function() {
155
+
156
+ // Set variables
157
+ var color = $( this ).attr( 'data-select-color' );
158
+ var color_text = $( this ).attr( 'data-select-color-text' );
159
+
160
+ // Preview
161
+ $( this ).closest( '.postbox' ).css( 'background-color', color );
162
+ $( this ).closest( '.wp-dashboard-note-wrap' ).attr( 'data-color-text', color_text );
163
+
164
+ // Set saving attributes
165
+ $( this ).closest( '[data-note-color]' ).attr( 'data-note-color', color );
166
+ $( this ).closest( '[data-color-text]' ).attr( 'data-color-text', color_text );
167
+
168
+ // Update note
169
+ $( this ).trigger( 'wpdn-update', this );
170
+
171
+ });
172
+
173
+
174
+ // Edit/update note
175
+ $( document.body ).on( 'blur', '.list-item-content, [contenteditable=true]', function() {
176
+ $( this ).trigger( 'wpdn-update', this );
177
+ });
178
+
179
+ // Save on enter (list note)
180
+ $( document.body ).on( 'keydown', '[data-note-type=list], .wpdn-title, .list-item-content', function( e ) {
181
+ if ( e.keyCode == 13 ) {
182
+ $( this ).trigger( 'wpdn-update', this );
183
+ $( this ).blur();
184
+ return false;
185
+ }
186
+ });
187
+ // Save on CMD|CTRL + enter (regular note)
188
+ $( document.body ).on( 'keydown', '[data-note-type=regular] .wp-dashboard-note', function( e ) {
189
+ if ( e.keyCode == 13 && ( e.ctrlKey || e.metaKey ) ) {
190
+ $( this ).trigger( 'wpdn-update', this );
191
+ $( this ).blur();
192
+ return false;
193
+ }
194
+ });
195
+
196
+
197
+ // Edit title
198
+ $( 'body, .postbox .hndle' ).on( 'click', '.wpdn-edit-title', function( e ) {
199
+ $( this ).prev().focus();
200
+ document.execCommand( 'selectAll', false, null );
201
+ e.stopPropagation();
202
+ });
203
+
204
+
205
+ // Note checkbox toggle
206
+ $( 'input[type=checkbox]' ).change( function() {
207
+ if( this.checked ) {
208
+ $( this ).attr( 'checked', 'checked' );
209
+ } else {
210
+ $( this ).removeAttr( 'checked' );
211
+ }
212
+ $( this ).trigger( 'wpdn-update', this );
213
+ });
214
+
215
+
216
+ // Make list sortable
217
+ $( document.body ).on( 'note-sortable', function() {
218
+ $( '.wp-dashboard-note' ).sortable({
219
+ handle: '.wpdn-note-sortable',
220
+ update: function( event, ui ) {
221
+ $( this ).trigger( 'wpdn-update', this );
222
+ },
223
+ connectWith: ['.wp-dashboard-note'],
224
+ axis: 'y'
225
+ });
226
+ })
227
+ .trigger( 'note-sortable' );
228
+
229
+
230
+ // Open link box when hovering a link
231
+ $( '.wp-dashboard-note-wrap a' ).hover( function() {
232
+ $( this ).append( '<span class="link-hover" contenteditable="false"><a href="' + $( this ).attr( 'href' ) + '" target="_blank" contenteditable="false">Open link</a></span>' );
233
+ }, function() {
234
+ $( '.link-hover' ).remove();
235
+ });
236
+
237
+ // Prevent background color and other style from copying from one note to the other
238
+ $( document.body ).on('paste', '[contenteditable]', function (e) {
239
+ e.preventDefault();
240
+ var text = (e.originalEvent || e).clipboardData.getData('text/plain');
241
+ document.execCommand('insertText', false, text);
242
+ });
243
+
244
+ });
assets/js/wp-dashboard-notes-admin.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function($){var t='<span class="saving-icon"><img src="images/wpspin_light.gif"/> saving...</span>',e='<span class="saved-icon"><div class="dashicons dashicons-yes"></div> saved!</span>';$("body, .list-item-content").on("keydown",".add-list-item",function(t){if(13==t.keyCode&&""!=$(this).val()){var e=$(this).closest(".postbox").attr("id"),o='<div class="list-item"><div class="dashicons dashicons-menu wpdn-note-sortable"></div><input type="checkbox"><span class="list-item-content" contenteditable="true">'+$(this).val()+'</span><div class="delete-item dashicons dashicons-no-alt"></div></div>';$("#"+e+" div.wp-dashboard-note").append(o),$(this).val(""),$(this).trigger("note-sortable"),$(this).trigger("wpdn-update",this)}}),$(document.body).on("click",".delete-item",function(){var t=$(this).closest(".postbox").attr("id");$(this).parent(".list-item").remove(),$(document.body).trigger("wpdn-update",["",t])}),$(document.body).on("click",".wpdn-visibility",function(){$(this).toggleClass("dashicons-admin-users dashicons-groups");var t=$(this).parent().attr("data-visibility");"public"==t?($(this).parent(".wpdn-toggle-visibility").attr("data-visibility","private"),$(this).parent(".wpdn-toggle-visibility").attr("title","Visibility: Just me")):($(this).parent(".wpdn-toggle-visibility").attr("data-visibility","public"),$(this).parent(".wpdn-toggle-visibility").attr("title","Visibility: Everyone")),$(this).trigger("wpdn-update",this)}),$(document.body).on("click",".wpdn-note-type",function(){$(this).toggleClass("dashicons-list-view dashicons-welcome-write-blog");var t=$(this).closest("[data-note-type]").attr("data-note-type");"regular"==t?$(this).closest("[data-note-type]").attr("data-note-type","list"):$(this).closest("[data-note-type]").attr("data-note-type","regular");var e={action:"wpdn_toggle_note",post_id:$(this).closest(".postbox").attr("id").replace("note_",""),note_type:"regular"==t?"list":"regular"};$.post(ajaxurl,e,function(t){$("#note_"+e.post_id+" .inside").html(t).trigger("note-sortable")}),$(this).trigger("wpdn-update",this)}),$(document.body).on("wpdn-update",function(o,i,n){if(""!=i&&(n=$(i).closest(".postbox").attr("id")),n){$("#"+n+" .hndle .status").html(t);var a={action:"wpdn_update_note",post_id:n.replace("note_",""),post_content:$("#"+n+" div.wp-dashboard-note").html(),post_title:$("#"+n+" > .hndle .wpdn-title").html(),note_visibility:$("#"+n+" [data-visibility]").attr("data-visibility"),note_color_text:$("#"+n+" [data-color-text]").attr("data-color-text"),note_color:$("#"+n+" [data-note-color]").attr("data-note-color"),note_type:$("#"+n+" [data-note-type]").attr("data-note-type")};$.post(ajaxurl,a,function(t){$("#"+n+" .hndle .status").html(e),$("#"+n+" .hndle .status *").fadeOut(1e3,function(){$(this).html("")})})}}),$(document.body).on("click",".wpdn-delete-note",function(){var t=$(this).closest(".postbox").attr("id");$("#"+t).slideUp(500,function(){$(this).remove()});var e={action:"wpdn_delete_note",post_id:t.replace("note_","")};$.post(ajaxurl,e)}),$(document.body).on("click",".wpdn-add-note, #wp-admin-bar-wpdn-add-note a",function(t){var e={action:"wpdn_add_note"};$.post(ajaxurl,e,function(t){t=jQuery.parseJSON(t),jQuery("#postbox-container-1 #normal-sortables").append(t.note),jQuery("body, html").animate({scrollTop:$("#note_"+t.post_id).offset().top-50},750),jQuery("#note_"+t.post_id+" .add-list-item").focus()}),$("html, body").bind("scroll mousedown DOMMouseScroll mousewheel keyup",function(t){(t.which>0||"mousedown"===t.type||"mousewheel"===t.type)&&$("html, body").stop().unbind("scroll mousedown DOMMouseScroll mousewheel keyup")}),t.preventDefault()}),$(document.body).on("click",".color",function(){var t=$(this).attr("data-select-color"),e=$(this).attr("data-select-color-text");$(this).closest(".postbox").css("background-color",t),$(this).closest(".wp-dashboard-note-wrap").attr("data-color-text",e),$(this).closest("[data-note-color]").attr("data-note-color",t),$(this).closest("[data-color-text]").attr("data-color-text",e),$(this).trigger("wpdn-update",this)}),$(document.body).on("blur",".list-item-content, [contenteditable=true]",function(){$(this).trigger("wpdn-update",this)}),$(document.body).on("keydown","[data-note-type=list], .wpdn-title, .list-item-content",function(t){return 13==t.keyCode?($(this).trigger("wpdn-update",this),$(this).blur(),!1):void 0}),$(document.body).on("keydown","[data-note-type=regular] .wp-dashboard-note",function(t){return 13==t.keyCode&&(t.ctrlKey||t.metaKey)?($(this).trigger("wpdn-update",this),$(this).blur(),!1):void 0}),$("body, .postbox .hndle").on("click",".wpdn-edit-title",function(t){$(this).prev().focus(),document.execCommand("selectAll",!1,null),t.stopPropagation()}),$("input[type=checkbox]").change(function(){this.checked?$(this).attr("checked","checked"):$(this).removeAttr("checked"),$(this).trigger("wpdn-update",this)}),$(document.body).on("note-sortable",function(){$(".wp-dashboard-note").sortable({handle:".wpdn-note-sortable",update:function(t,e){$(this).trigger("wpdn-update",this)},connectWith:[".wp-dashboard-note"],axis:"y"})}).trigger("note-sortable"),$(".wp-dashboard-note-wrap a").hover(function(){$(this).append('<span class="link-hover" contenteditable="false"><a href="'+$(this).attr("href")+'" target="_blank" contenteditable="false">Open link</a></span>')},function(){$(".link-hover").remove()}),$(document.body).on("paste","[contenteditable]",function(t){t.preventDefault();var e=(t.originalEvent||t).clipboardData.getData("text/plain");document.execCommand("insertText",!1,e)})});
includes/class-note-post-type.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ /**
5
+ * Class Note_Post_Type.
6
+ *
7
+ * Register and handle post type registration.
8
+ *
9
+ * @class Note_Post_Type
10
+ * @version 1.0.0
11
+ * @package WP Dashboard Notes
12
+ * @author Jeroen Sormani
13
+ */
14
+ class Note_Post_Type {
15
+
16
+
17
+ /**
18
+ * Constructor.
19
+ *
20
+ * @since 1.0.0
21
+ */
22
+ public function __construct() {
23
+
24
+ // Register post type
25
+ add_action( 'init', array( $this, 'register_post_type' ) );
26
+
27
+ }
28
+
29
+
30
+ /**
31
+ * Register post type.
32
+ *
33
+ * Register and set settings for post type 'note'.
34
+ *
35
+ * @since 1.0.0
36
+ */
37
+ public function register_post_type() {
38
+
39
+ $labels = array(
40
+ 'name' => __( 'Notes', 'wp-dashboard-notes' ),
41
+ 'singular_name' => __( 'Note', 'wp-dashboard-notes' ),
42
+ 'add_new' => __( 'Add New', 'wp-dashboard-notes' ),
43
+ 'add_new_item' => __( 'Add New Note', 'wp-dashboard-notes' ),
44
+ 'edit_item' => __( 'Edit Note', 'wp-dashboard-notes' ),
45
+ 'new_item' => __( 'New Note', 'wp-dashboard-notes' ),
46
+ 'view_item' => __( 'View Note', 'wp-dashboard-notes' ),
47
+ 'search_items' => __( 'Search Notes', 'wp-dashboard-notes' ),
48
+ 'not_found' => __( 'No Notes', 'wp-dashboard-notes' ),
49
+ 'not_found_in_trash' => __( 'No Notes found in Trash', 'wp-dashboard-notes' ),
50
+ );
51
+
52
+ register_post_type( 'note', array(
53
+ 'label' => 'note',
54
+ 'show_ui' => false,
55
+ 'show_in_menu' => false,
56
+ 'capability_type' => 'post',
57
+ 'map_meta_cap' => true,
58
+ 'rewrite' => array( 'slug' => 'notes' ),
59
+ '_builtin' => false,
60
+ 'query_var' => true,
61
+ 'supports' => array( 'title', 'editor' ),
62
+ 'labels' => $labels,
63
+ ) );
64
+
65
+ }
66
+
67
+ }
68
+
69
+ // Backwards compatibility
70
+ $GLOBALS['wpdn_post_type'] = WP_Dashboard_Notes()->post_type;
includes/class-wpdn-admin.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ /**
5
+ * Class WPDN_Admin.
6
+ *
7
+ * Admin class holds all admin related functions.
8
+ *
9
+ * @class WPDN_Admin
10
+ * @version 1.0.0
11
+ * @author Jeroen Sormani
12
+ */
13
+ class WPDN_Admin {
14
+
15
+
16
+ /**
17
+ * Constructor.
18
+ *
19
+ * @since 1.0.0
20
+ */
21
+ public function __construct() {
22
+
23
+ // Admin bar 'add note' button
24
+ add_action( 'admin_bar_menu', array( $this, 'admin_bar_add_note' ) );
25
+
26
+ }
27
+
28
+
29
+ /**
30
+ * Admin bar add note.
31
+ *
32
+ * Add a item to the admin bar to add a new note.
33
+ *
34
+ * @since 1.0.7
35
+ *
36
+ * @param $wp_admin_bar Arg that will allow one to add new items.
37
+ */
38
+ public function admin_bar_add_note( &$wp_admin_bar ) {
39
+
40
+ $screen = get_current_screen();
41
+
42
+ // Only show on dashboard
43
+ if ( 'dashboard' !== $screen->id ) {
44
+ return;
45
+ }
46
+
47
+ $wp_admin_bar->add_menu( array(
48
+ 'id' => 'wpdn-add-note',
49
+ 'parent' => 'top-secondary',
50
+ 'title' => '+ ' . __( 'Add note', 'wp-dashboard-notes' ),
51
+ 'href' => 'javascript:void(0);',
52
+ ) );
53
+
54
+ }
55
+
56
+
57
+ }
includes/class-wpdn-ajax.php ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ /**
5
+ * Class WPDN_Ajax.
6
+ *
7
+ * Class to handle all AJAX calls.
8
+ *
9
+ * @class WPDN_Ajax
10
+ * @version 1.0.0
11
+ * @package WP Dashboard Notes
12
+ * @author Jeroen Sormani
13
+ */
14
+ class WPDN_Ajax {
15
+
16
+
17
+ /**
18
+ * Constructor.
19
+ *
20
+ * Add ajax actions.
21
+ *
22
+ * @since 1.0.0
23
+ */
24
+ public function __construct() {
25
+
26
+ // Update note
27
+ add_action( 'wp_ajax_wpdn_update_note', array( $this, 'wpdn_update_note' ) );
28
+ add_action( 'wp_ajax_wpdn_toggle_note', array( $this, 'wpdn_toggle_note' ) );
29
+
30
+ // Add / Delete note
31
+ add_action( 'wp_ajax_wpdn_add_note', array( $this, 'wpdn_add_note' ) );
32
+ add_action( 'wp_ajax_wpdn_delete_note', array( $this, 'wpdn_delete_note' ) );
33
+
34
+ }
35
+
36
+
37
+ /**
38
+ * Update note.
39
+ *
40
+ * Update note + meta when the jQuery update trigger is triggered.
41
+ *
42
+ * @since 1.0.0
43
+ */
44
+ public function wpdn_update_note() {
45
+
46
+ $post = array(
47
+ 'ID' => $_POST['post_id'],
48
+ 'post_title' => $_POST['post_title'],
49
+ 'post_content' => $_POST['post_content'],
50
+ );
51
+
52
+ wp_update_post( $post );
53
+
54
+ $note_meta = array(
55
+ 'color' => $_POST['note_color'],
56
+ 'color_text' => $_POST['note_color_text'],
57
+ 'visibility' => $_POST['note_visibility'],
58
+ 'note_type' => $_POST['note_type'],
59
+ );
60
+ update_post_meta( $_POST['post_id'], '_note', $note_meta );
61
+
62
+ die();
63
+
64
+ }
65
+
66
+
67
+ /**
68
+ * Toggle note.
69
+ *
70
+ * Toggle note type, from 'regular note' to 'list note' or vice versa.
71
+ *
72
+ * @since 1.0.0
73
+ */
74
+ public function wpdn_toggle_note() {
75
+
76
+ $note = get_post( $_POST['post_id'] );
77
+ $content = apply_filters( 'wpdn_content', $note->post_content );
78
+ $colors = apply_filters( 'wpdn_colors', array(
79
+ 'white' => '#fff',
80
+ 'red' => '#f7846a',
81
+ 'orange' => '#ffbd22',
82
+ 'yellow' => '#eeee22',
83
+ 'green' => '#bbe535',
84
+ 'blue' => '#66ccdd',
85
+ 'black' => '#777777',
86
+ ) );
87
+ $note_meta = WP_Dashboard_Notes::wpdn_get_note_meta( $note->ID );
88
+
89
+ ?>
90
+ <style>
91
+ #note_<?php echo $note->ID; ?> { background-color: <?php echo $note_meta['color']; ?>; }
92
+ #note_<?php echo $note->ID; ?> .hndle { border: none; }
93
+ </style>
94
+ <?php
95
+ if ( $_POST['note_type'] == 'regular' ) :
96
+ require plugin_dir_path( __FILE__ ) . 'templates/note.php';
97
+ else :
98
+ require plugin_dir_path( __FILE__ ) . 'templates/note-list.php';
99
+ endif;
100
+
101
+ die();
102
+
103
+ }
104
+
105
+
106
+ /**
107
+ * Add new note.
108
+ *
109
+ * Create a new note, return two variables (post ID | note content) to jQuery through json_encode.
110
+ *
111
+ * @since 1.0.0
112
+ */
113
+ public function wpdn_add_note() {
114
+
115
+ $args = array(
116
+ 'post_status' => 'publish',
117
+ 'post_type' => 'note',
118
+ 'post_title' => __( 'New note', 'wp-dashboard-notes' ),
119
+ );
120
+ $post_id = wp_insert_post( $args );
121
+
122
+ $note = (object) array( 'ID' => $post_id, 'post_content' => '' );
123
+ $note_meta = apply_filters( 'wpdn_new_note_meta', array(
124
+ 'color' => '#ffffff',
125
+ 'color_text' => 'white',
126
+ 'visibility' => 'Everyone',
127
+ 'note_type' => 'list',
128
+ ) );
129
+ $content = apply_filters( 'wpdn_content', $note->post_content );
130
+ $colors = apply_filters( 'wpdn_colors', array(
131
+ 'white' => '#fff',
132
+ 'red' => '#f7846a',
133
+ 'orange' => '#ffbd22',
134
+ 'yellow' => '#eeee22',
135
+ 'green' => '#bbe535',
136
+ 'blue' => '#66ccdd',
137
+ 'black' => '#777777',
138
+ ) );
139
+ $note_meta = apply_filters( 'wpdn_new_note_meta', $note_meta );
140
+ update_post_meta( $post_id, '_note', $note_meta );
141
+
142
+ $title_tag = version_compare( get_bloginfo( 'version' ), '4.4', '>=' ) ? 'h2' : 'h3';
143
+
144
+ ob_start(); ?>
145
+
146
+ <div id='note_<?php echo $post_id; ?>' class='postbox'>
147
+ <div class='handlediv' title='Click to toggle'><br></div>
148
+ <<?php echo $title_tag; ?> class="hndle">
149
+ <span>
150
+ <span contenteditable="true" class="wpdn-title"><?php _e( 'New note', 'wp-dashboard-notes' ); ?></span>
151
+ <div class="wpdn-edit-title dashicons dashicons-edit"></div>
152
+ <span class="status"></span>
153
+ </span>
154
+ </<?php echo $title_tag; ?>>
155
+
156
+ <div class='inside'>
157
+
158
+ <style>
159
+ #note_<?php echo $post_id; ?> { background-color: <?php echo $note_meta['color']; ?>; }
160
+ #note_<?php echo $post_id; ?> .hndle { border: none; }
161
+ </style>
162
+
163
+ <?php if ( 'regular' == $note_meta['note_type'] ) :
164
+ require plugin_dir_path( __FILE__ ) . 'templates/note.php';
165
+ else :
166
+ require plugin_dir_path( __FILE__ ) . 'templates/note-list.php';
167
+ endif; ?>
168
+
169
+ </div> <!-- .inside -->
170
+ </div> <!-- .postbox -->
171
+
172
+ <?php
173
+ $return['note'] = ob_get_clean();
174
+ $return['post_id'] = $post_id;
175
+
176
+ echo json_encode( $return );
177
+
178
+ die();
179
+
180
+ }
181
+
182
+
183
+ /**
184
+ * Delete note.
185
+ *
186
+ * Post is trashed and not permanently deleted.
187
+ *
188
+ * @since 1.0.0
189
+ */
190
+ public function wpdn_delete_note() {
191
+
192
+ $post_id = (int) $_POST['post_id'];
193
+ wp_trash_post( $post_id );
194
+ die();
195
+
196
+ }
197
+
198
+
199
+ }
includes/templates/note-list.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class='wp-dashboard-note-wrap list-note' data-note-type='list' data-color-text='<?php echo $note_meta['color_text']; ?>' data-note-color='<?php echo $note_meta['color']; ?>'>
2
+
3
+ <div class='wp-dashboard-note'>
4
+ <?php echo $content; ?>
5
+ </div>
6
+
7
+ <div class='wp-dashboard-note-options'>
8
+ <div class='dashicons dashicons-plus wpdn-add-item'></div>
9
+ <input type='text' name='list_item' class='add-list-item' data-id='<?php echo $note->ID; ?>' placeholder='<?php _e( 'List item', 'wp-dashboard-notes' ); ?>'>
10
+ <span class='status'></span>
11
+ <div class='wpdn-extra'>
12
+ <span class='wpdn-option-visibility'>
13
+ <?php
14
+ if ( 'private' == $note_meta['visibility'] && $note_meta ) :
15
+ $status['icon'] = 'dashicons-admin-users';
16
+ $status['title'] = __( 'Just me', 'wp-dashboard-notes' );
17
+ $status['visibility'] = 'private';
18
+ else :
19
+ $status['icon'] = 'dashicons-groups';
20
+ $status['title'] = __( 'Everyone', 'wp-dashboard-notes' );
21
+ $status['visibility'] = 'public';
22
+ endif; ?>
23
+
24
+ <span class='wpdn-toggle-visibility' title='<?php _e( 'Visibility:', 'wp-dashboard-notes' ); ?> <?php echo $status['title']; ?>' data-visibility='<?php echo $status['visibility']; ?>'>
25
+ <div class='wpdn-visibility visibility-publish dashicons <?php echo $status['icon']; ?>'></div>
26
+ </span>
27
+
28
+ <span class='wpdn-color-note' title='<?php _e( 'Give me a color!', 'wp-dashboard-notes' ); ?>'>
29
+ <span class='wpdn-color-palette'>
30
+
31
+ <?php foreach ( $colors as $name => $color ) : ?>
32
+ <span class='color color-<?php echo $name;?>' data-select-color-text='<?php echo $name; ?>' data-select-color='<?php echo $color; ?>' style='background-color: <?php echo $color; ?>'></span>
33
+ <?php endforeach; ?>
34
+
35
+ </span>
36
+ <div class='dashicons dashicons-art wpdn-note-color'></div>
37
+ </span>
38
+
39
+ <span title='<?php _e( 'Convert to regular note', 'wp-dashboard-notes'); ?>'>
40
+ <div class='wpdn-note-type dashicons dashicons-welcome-write-blog'></div>
41
+ </span>
42
+
43
+ <span class='wpdn-add-note' title='<?php _e( 'Add a new note', 'wp-dashboard-notes' ); ?>'>
44
+ <div class='dashicons dashicons-plus'></div>
45
+ </span>
46
+
47
+
48
+ <span style='float: right; margin-right: 10px;' class='wpdn-delete-note' title='<?php _e( 'Delete note', 'wp-dashboard-notes' ); ?>'>
49
+ <div class='dashicons dashicons-trash'></div>
50
+ </span>
51
+
52
+ </span>
53
+ </div>
54
+ </div>
55
+
56
+ </div>
includes/templates/note.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class='wp-dashboard-note-wrap regular-note' data-note-type='regular' data-color-text='<?php echo $note_meta['color_text']; ?>' data-note-color='<?php echo $note_meta['color']; ?>'>
2
+
3
+ <div class='wp-dashboard-note' contenteditable='true'>
4
+ <?php echo $content; ?>
5
+ </div>
6
+
7
+ <div class='wp-dashboard-note-options'>
8
+
9
+ <span class='status'></span>
10
+ <div class='wpdn-extra'>
11
+ <span class='wpdn-option-visibility'>
12
+ <?php
13
+ if ( 'private' == $note_meta['visibility'] && $note_meta ) :
14
+ $status['icon'] = 'dashicons-admin-users';
15
+ $status['title'] = __( 'Just me', 'wp-dashboard-notes' );
16
+ $status['visibility'] = 'private';
17
+ else :
18
+ $status['icon'] = 'dashicons-groups';
19
+ $status['title'] = __( 'Everyone', 'wp-dashboard-notes' );
20
+ $status['visibility'] = 'public';
21
+ endif; ?>
22
+
23
+ <span class='wpdn-toggle-visibility' title='<?php _e( 'Visibility:', 'wp-dashboard-notes' ); ?> <?php echo $status['title']; ?>' data-visibility='<?php echo $status['visibility']; ?>'>
24
+ <div class='wpdn-visibility visibility-publish dashicons <?php echo $status['icon']; ?>'></div>
25
+ </span>
26
+
27
+ <span class='wpdn-color-note' title='<?php _e( 'Give me a color!', 'wp-dashboard-notes' ); ?>'>
28
+ <span class='wpdn-color-palette'>
29
+
30
+ <?php foreach ( $colors as $name => $color ) : ?>
31
+ <span class='color color-<?php echo $name;?>' data-select-color-text='<?php echo $name; ?>' data-select-color='<?php echo $color; ?>' style='background-color: <?php echo $color; ?>'></span>
32
+ <?php endforeach; ?>
33
+
34
+ </span>
35
+ <div class='dashicons dashicons-art wpdn-note-color'></div>
36
+ </span>
37
+
38
+ <span title='<?php _e( 'Convert to list note', 'wp-dashboard-notes'); ?>'>
39
+ <div class='wpdn-note-type dashicons dashicons-list-view'></div>
40
+ </span>
41
+
42
+ <span class='wpdn-add-note' title='<?php _e( 'Add a new note', 'wp-dashboard-notes' ); ?>'>
43
+ <div class='dashicons dashicons-plus'></div>
44
+ </span>
45
+
46
+ <span style='float: right; margin-right: 10px;' class='wpdn-delete-note' title='<?php _e( 'Delete note', 'wp-dashboard-notes' ); ?>'>
47
+ <div class='dashicons dashicons-trash'></div>
48
+ </span>
49
+
50
+ </span>
51
+ </div>
52
+ </div>
53
+
54
+ </div>
languages/wp-dashboard-notes-nl_NL.mo ADDED
Binary file
languages/wp-dashboard-notes-nl_NL.po ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: wp-dashboard-notes\n"
4
+ "POT-Creation-Date: 2014-08-28 09:06+0100\n"
5
+ "PO-Revision-Date: 2014-08-28 09:08+0100\n"
6
+ "Last-Translator: \n"
7
+ "Language-Team: Jeroen Sormani <info@jeroensormani.com>\n"
8
+ "Language: nl_NL\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "X-Generator: Poedit 1.5.5\n"
13
+ "X-Poedit-KeywordsList: _;gettext;gettext_noop;__;_e\n"
14
+ "X-Poedit-Basepath: .\n"
15
+ "X-Poedit-SearchPath-0: ..\n"
16
+
17
+ #: ../wp-dashboard-notes.php:210
18
+ msgid "Add note"
19
+ msgstr "Nieuwe notitie"
20
+
21
+ #: ../includes/class-note-post-type.php:39
22
+ msgid "Notes"
23
+ msgstr "Notities"
24
+
25
+ #: ../includes/class-note-post-type.php:40
26
+ msgid "Note"
27
+ msgstr "Notitie"
28
+
29
+ #: ../includes/class-note-post-type.php:41
30
+ msgid "Add New"
31
+ msgstr "Nieuwe toevoegen"
32
+
33
+ #: ../includes/class-note-post-type.php:42
34
+ msgid "Add New Note"
35
+ msgstr "Nieuwe notitie toevoegen"
36
+
37
+ #: ../includes/class-note-post-type.php:43
38
+ msgid "Edit Note"
39
+ msgstr "Notitie bewerken"
40
+
41
+ #: ../includes/class-note-post-type.php:44
42
+ msgid "New Note"
43
+ msgstr "Nieuwe notitie"
44
+
45
+ #: ../includes/class-note-post-type.php:45
46
+ msgid "View Note"
47
+ msgstr "Bekijk notitie"
48
+
49
+ #: ../includes/class-note-post-type.php:46
50
+ msgid "Search Notes"
51
+ msgstr "Zoek in notities"
52
+
53
+ #: ../includes/class-note-post-type.php:47
54
+ msgid "No Notes"
55
+ msgstr "Geen notities"
56
+
57
+ #: ../includes/class-note-post-type.php:48
58
+ msgid "No Notes found in Trash"
59
+ msgstr "Geen notities gevonden in de prullenbak"
60
+
61
+ #: ../includes/class-wpdn-ajax.php:108 ../includes/class-wpdn-ajax.php:128
62
+ msgid "New note"
63
+ msgstr "Nieuwe notitie"
64
+
65
+ #: ../includes/templates/note-list.php:9
66
+ msgid "List item"
67
+ msgstr "Lijst item"
68
+
69
+ #: ../includes/templates/note-list.php:16 ../includes/templates/note.php:15
70
+ msgid "Just me"
71
+ msgstr "Alleen ik"
72
+
73
+ #: ../includes/templates/note-list.php:20 ../includes/templates/note.php:19
74
+ msgid "Everyone"
75
+ msgstr "Iedereen"
76
+
77
+ #: ../includes/templates/note-list.php:24 ../includes/templates/note.php:23
78
+ msgid "Visibility:"
79
+ msgstr "Zichtbaarheid:"
80
+
81
+ #: ../includes/templates/note-list.php:28 ../includes/templates/note.php:27
82
+ msgid "Give me a color!"
83
+ msgstr "Geef mij een kleur!"
84
+
85
+ #: ../includes/templates/note-list.php:41
86
+ msgid "Convert to regular note"
87
+ msgstr "Converteer mij naar een normale notitie"
88
+
89
+ #: ../includes/templates/note-list.php:45 ../includes/templates/note.php:44
90
+ msgid "Add a new note"
91
+ msgstr "Voeg een nieuwe notitie toe"
92
+
93
+ #: ../includes/templates/note-list.php:50 ../includes/templates/note.php:48
94
+ msgid "Delete note"
95
+ msgstr "Verwijder notitie"
96
+
97
+ #: ../includes/templates/note.php:40
98
+ msgid "Convert to list note"
99
+ msgstr "Converteer mij naar een lijst notitie"
languages/wp-dashboard-notes-ru_RU.mo ADDED
Binary file
languages/wp-dashboard-notes-ru_RU.po ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: WP Dashboard Notes v1.0.4\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2015-01-19 18:05:27+0000\n"
7
+ "Last-Translator: administrator <admin@vsevyazemy.ru>\n"
8
+ "Language-Team: \n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "Plural-Forms: nplurals=3; plural=n%100/10==1 ? 2 : n%10==1 ? 0 : (n+9)%10>3 ? 2 : 1;\n"
13
+ "X-Generator: CSL v1.x\n"
14
+ "X-Poedit-Language: Russian\n"
15
+ "X-Poedit-Country: RUSSIA\n"
16
+ "X-Poedit-SourceCharset: utf-8\n"
17
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
18
+ "X-Poedit-Basepath: ../\n"
19
+ "X-Poedit-Bookmarks: \n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+ "X-Textdomain-Support: yes"
22
+
23
+ #: includes/class-note-post-type.php:39
24
+ #@ wp-dashboard-notes
25
+ msgid "Notes"
26
+ msgstr "Заметки"
27
+
28
+ #: includes/class-note-post-type.php:40
29
+ #@ wp-dashboard-notes
30
+ msgid "Note"
31
+ msgstr "Заметка"
32
+
33
+ #: includes/class-note-post-type.php:41
34
+ #@ wp-dashboard-notes
35
+ msgid "Add New"
36
+ msgstr "Добавить"
37
+
38
+ #: includes/class-note-post-type.php:42
39
+ #@ wp-dashboard-notes
40
+ msgid "Add New Note"
41
+ msgstr "Добавить"
42
+
43
+ #: includes/class-note-post-type.php:43
44
+ #@ wp-dashboard-notes
45
+ msgid "Edit Note"
46
+ msgstr "Изменить"
47
+
48
+ #: includes/class-note-post-type.php:44
49
+ #@ wp-dashboard-notes
50
+ msgid "New Note"
51
+ msgstr "Создать"
52
+
53
+ #: includes/class-note-post-type.php:45
54
+ #@ wp-dashboard-notes
55
+ msgid "View Note"
56
+ msgstr "Смотреть"
57
+
58
+ #: includes/class-note-post-type.php:46
59
+ #@ wp-dashboard-notes
60
+ msgid "Search Notes"
61
+ msgstr "Искать"
62
+
63
+ #: includes/class-note-post-type.php:47
64
+ #@ wp-dashboard-notes
65
+ msgid "No Notes"
66
+ msgstr "Нет заметок"
67
+
68
+ #: includes/class-note-post-type.php:48
69
+ #@ wp-dashboard-notes
70
+ msgid "No Notes found in Trash"
71
+ msgstr "В мусоре нет заметок"
72
+
73
+ #: includes/class-wpdn-ajax.php:118
74
+ #: includes/class-wpdn-ajax.php:148
75
+ #@ wp-dashboard-notes
76
+ msgid "New note"
77
+ msgstr "Создать"
78
+
79
+ #: includes/templates/note-list.php:9
80
+ #@ wp-dashboard-notes
81
+ msgid "List item"
82
+ msgstr "Список"
83
+
84
+ #: includes/templates/note-list.php:16
85
+ #: includes/templates/note.php:15
86
+ #@ wp-dashboard-notes
87
+ msgid "Just me"
88
+ msgstr "Приватно"
89
+
90
+ #: includes/templates/note-list.php:20
91
+ #: includes/templates/note.php:19
92
+ #@ wp-dashboard-notes
93
+ msgid "Everyone"
94
+ msgstr "Общедоступно"
95
+
96
+ #: includes/templates/note-list.php:24
97
+ #: includes/templates/note.php:23
98
+ #@ wp-dashboard-notes
99
+ msgid "Visibility:"
100
+ msgstr "Видимость:"
101
+
102
+ #: includes/templates/note-list.php:28
103
+ #: includes/templates/note.php:27
104
+ #@ wp-dashboard-notes
105
+ msgid "Give me a color!"
106
+ msgstr "Выбрать цвет"
107
+
108
+ #: includes/templates/note-list.php:39
109
+ #@ wp-dashboard-notes
110
+ msgid "Convert to regular note"
111
+ msgstr "Список > в текст"
112
+
113
+ #: includes/templates/note-list.php:43
114
+ #: includes/templates/note.php:42
115
+ #@ wp-dashboard-notes
116
+ msgid "Add a new note"
117
+ msgstr "Добавить"
118
+
119
+ #: includes/templates/note-list.php:48
120
+ #: includes/templates/note.php:46
121
+ #@ wp-dashboard-notes
122
+ msgid "Delete note"
123
+ msgstr "Удалить"
124
+
125
+ #: includes/templates/note.php:38
126
+ #@ wp-dashboard-notes
127
+ msgid "Convert to list note"
128
+ msgstr "Текст > в список"
129
+
130
+ #: wp-dashboard-notes.php:249
131
+ #@ wp-dashboard-notes
132
+ msgid "Add note"
133
+ msgstr "Добавить"
134
+
license.txt ADDED
@@ -0,0 +1,621 @@