update librarian
[redakcja.git] / redakcja / static / js / wiki / wikiapi.js
index d901e84..8df3ef5 100644 (file)
         * Set document's text
         */
        WikiDocument.prototype.setText = function(text) {
-               this.text = text;
-               this.has_local_changes = true;
+               return this.setDocumentProperty('text', text);
        };
 
        /*
         * Set document's gallery link
         */
        WikiDocument.prototype.setGalleryLink = function(gallery) {
-               this.galleryLink = gallery;
-               this.has_local_changes = true;
+               return this.setDocumentProperty('galleryLink', gallery);
+       };
+
+       /*
+        * Set document's property
+        */
+       WikiDocument.prototype.setDocumentProperty = function(property, value) {
+               if(this[property] !== value) {
+                       this[property] = value;
+                       this.has_local_changes = true;
+               }
        };
 
        /*